summary refs log tree commit diff
path: root/crypto/bzip2/src/CBZip2InputStream.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/bzip2/src/CBZip2InputStream.cs')
-rw-r--r--crypto/bzip2/src/CBZip2InputStream.cs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crypto/bzip2/src/CBZip2InputStream.cs b/crypto/bzip2/src/CBZip2InputStream.cs
index 111b1b530..c3125a4e7 100644
--- a/crypto/bzip2/src/CBZip2InputStream.cs
+++ b/crypto/bzip2/src/CBZip2InputStream.cs
@@ -465,7 +465,6 @@ namespace Org.BouncyCastle.Apache.Bzip2
 
         private void GetAndMoveToFrontDecode()
         {
-            byte[] yy = new byte[256];
             int i, j, nextSym;
 
             int limitLast = BZip2Constants.baseBlockSize * blockSize100k;
@@ -487,9 +486,10 @@ namespace Org.BouncyCastle.Apache.Bzip2
             */
             Array.Clear(unzftab, 0, unzftab.Length);
 
-            for (i = 0; i <= 255; i++)
+            byte[] yy = new byte[nInUse];
+            for (i = 0; i < nInUse; ++i)
             {
-                yy[i] = (byte)i;
+                yy[i] = seqToUnseq[i];
             }
 
             last = -1;
@@ -567,7 +567,7 @@ namespace Org.BouncyCastle.Apache.Bzip2
                     //while (nextSym == BZip2Constants.RUNA || nextSym == BZip2Constants.RUNB);
                     while (nextSym <= BZip2Constants.RUNB);
 
-                    byte ch = seqToUnseq[yy[0]];
+                    byte ch = yy[0];
                     unzftab[ch] += s;
 
                     if (last >= limitLast - s)
@@ -586,8 +586,8 @@ namespace Org.BouncyCastle.Apache.Bzip2
                         throw new InvalidOperationException("Block overrun");
 
                     byte tmp = yy[nextSym - 1];
-                    unzftab[seqToUnseq[tmp]]++;
-                    ll8[last] = seqToUnseq[tmp];
+                    unzftab[tmp]++;
+                    ll8[last] = tmp;
 
                     /*
                      * This loop is hammered during decompression, hence avoid