gunzip was incorrectly reporting a failed crc and length (discovered by
authorGlenn L McGrath <bug1@ihug.co.nz>
Thu, 29 Nov 2001 06:36:56 +0000 (06:36 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Thu, 29 Nov 2001 06:36:56 +0000 (06:36 -0000)
Chang, Shu-Hao).  The bitbuffer needs to be unwound after decompression,
as it was eating into the crc/size field.

archival/libunarchive/decompress_unzip.c
archival/libunarchive/unzip.c
libbb/unzip.c

index bb32891be46fec30d8c6315f5615a615dfad0961..69cc8198ba1bfa303c76763df11c513ea10fb1f2 100644 (file)
@@ -875,6 +875,14 @@ static int inflate(void)
                }
        } while (!e);
 
+       /* Undo too much lookahead. The next read will be byte aligned so we
+        * can discard unused bits in the last meaningful byte.
+        */
+       while (bk >= 8) {
+               bk -= 8;
+               ungetc((bb << bk), in_file);
+       }
+
        /* flush out window */
        flush_window();
 
index bb32891be46fec30d8c6315f5615a615dfad0961..69cc8198ba1bfa303c76763df11c513ea10fb1f2 100644 (file)
@@ -875,6 +875,14 @@ static int inflate(void)
                }
        } while (!e);
 
+       /* Undo too much lookahead. The next read will be byte aligned so we
+        * can discard unused bits in the last meaningful byte.
+        */
+       while (bk >= 8) {
+               bk -= 8;
+               ungetc((bb << bk), in_file);
+       }
+
        /* flush out window */
        flush_window();
 
index bb32891be46fec30d8c6315f5615a615dfad0961..69cc8198ba1bfa303c76763df11c513ea10fb1f2 100644 (file)
@@ -875,6 +875,14 @@ static int inflate(void)
                }
        } while (!e);
 
+       /* Undo too much lookahead. The next read will be byte aligned so we
+        * can discard unused bits in the last meaningful byte.
+        */
+       while (bk >= 8) {
+               bk -= 8;
+               ungetc((bb << bk), in_file);
+       }
+
        /* flush out window */
        flush_window();