From: Tim Kientzle Date: Mon, 22 Aug 2016 00:01:54 +0000 (-0700) Subject: Issue #748: Zip decompression failure with highly-compressed data X-Git-Tag: v3.2.2~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da3b3c19d02591161bf53cbe4e520dde14557247;p=thirdparty%2Flibarchive.git Issue #748: Zip decompression failure with highly-compressed data 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. --- diff --git a/libarchive/archive_read_support_format_zip.c b/libarchive/archive_read_support_format_zip.c index 90c32bd5e..9796fca16 100644 --- a/libarchive/archive_read_support_format_zip.c +++ b/libarchive/archive_read_support_format_zip.c @@ -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);