From 338fb93d5e42d6a16808a1ea7577d681d2feeb57 Mon Sep 17 00:00:00 2001 From: Michihiro NAKAJIMA Date: Tue, 20 Mar 2012 19:40:10 +0900 Subject: [PATCH] An additional fix of issue 249. - Do not consume read bytes more than the entry used when reading an uncompressed CAB file. --- libarchive/archive_read_support_format_cab.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libarchive/archive_read_support_format_cab.c b/libarchive/archive_read_support_format_cab.c index bc866a375..81966c111 100644 --- a/libarchive/archive_read_support_format_cab.c +++ b/libarchive/archive_read_support_format_cab.c @@ -1932,6 +1932,11 @@ cab_read_data(struct archive_read *a, const void **buff, if (cab->entry_bytes_remaining == 0) cab->end_of_entry = 1; cab->entry_unconsumed = bytes_avail; + if (cab->entry_cffolder->comptype == COMPTYPE_NONE) { + /* Don't consume more than current entry used. */ + if (cab->entry_cfdata->unconsumed > cab->entry_unconsumed) + cab->entry_cfdata->unconsumed = cab->entry_unconsumed; + } return (ARCHIVE_OK); } -- 2.47.2