From: Tobias Stoeckmann Date: Sat, 18 May 2024 04:37:14 +0000 (+0200) Subject: cab: Cover all error cases in __archive_read_ahead (#2194) X-Git-Tag: v3.7.5~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=17333c27adc2d2c0d3831ae1dc98b48b19579d6d;p=thirdparty%2Flibarchive.git cab: Cover all error cases in __archive_read_ahead (#2194) If a short read is performed, fail with truncation error message as well. --- diff --git a/libarchive/archive_read_support_format_cab.c b/libarchive/archive_read_support_format_cab.c index 3b552a84d..4ed088d43 100644 --- a/libarchive/archive_read_support_format_cab.c +++ b/libarchive/archive_read_support_format_cab.c @@ -1682,7 +1682,7 @@ cab_read_ahead_cfdata_lzx(struct archive_read *a, ssize_t *avail) cfdata->uncompressed_size - cab->xstrm.total_out; d = __archive_read_ahead(a, 1, &bytes_avail); - if (bytes_avail <= 0) { + if (d == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Truncated CAB file data");