From da3b3c19d02591161bf53cbe4e520dde14557247 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Sun, 21 Aug 2016 17:01:54 -0700 Subject: [PATCH] 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. --- libarchive/archive_read_support_format_zip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.47.3