]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Issue #748: Zip decompression failure with highly-compressed data
authorTim Kientzle <kientzle@acm.org>
Mon, 22 Aug 2016 00:01:54 +0000 (17:01 -0700)
committerTim Kientzle <kientzle@acm.org>
Mon, 22 Aug 2016 00:04:49 +0000 (17:04 -0700)
Previously, we stopped driving the decompressor as soon as
we hit end of input, but in some cases, the decompressor
has internal state that can continue generating output
even when there is no more input.  So we now feed zero-length
blocks into the decompressor until the decompressor tells us
it is finished.

libarchive/archive_read_support_format_zip.c

index 90c32bd5e0562f544128abe9e12ee752b97e9293..9796fca161a6deddd82fc39397c6e6a6e55247d9 100644 (file)
@@ -1307,7 +1307,7 @@ zip_read_data_deflate(struct archive_read *a, const void **buff,
            && bytes_avail > zip->entry_bytes_remaining) {
                bytes_avail = (ssize_t)zip->entry_bytes_remaining;
        }
-       if (bytes_avail <= 0) {
+       if (bytes_avail < 0) {
                archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
                    "Truncated ZIP file body");
                return (ARCHIVE_FATAL);