gunzip was incorrectly reporting a failed crc and length (discovered by
Chang, Shu-Hao). The bitbuffer needs to be unwound after decompression,
as it was eating into the crc/size field.
diff --git a/libbb/unzip.c b/libbb/unzip.c
index bb32891..69cc819 100644
--- a/libbb/unzip.c
+++ b/libbb/unzip.c
@@ -875,6 +875,14 @@
}
} 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();