summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archival/libunarchive/decompress_unzip.c8
-rw-r--r--archival/libunarchive/unzip.c8
-rw-r--r--libbb/unzip.c8
3 files changed, 24 insertions, 0 deletions
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c
index bb32891..69cc819 100644
--- a/archival/libunarchive/decompress_unzip.c
+++ b/archival/libunarchive/decompress_unzip.c
@@ -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();
diff --git a/archival/libunarchive/unzip.c b/archival/libunarchive/unzip.c
index bb32891..69cc819 100644
--- a/archival/libunarchive/unzip.c
+++ b/archival/libunarchive/unzip.c
@@ -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();
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 @@ 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();