From: Tobias Stoeckmann Date: Fri, 3 May 2024 21:41:35 +0000 (+0200) Subject: rpm: Calculate huge header sizes correctly (#2158) X-Git-Tag: v3.7.5~89 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9f713540cc33a66a44728dd706aea487b989913;p=thirdparty%2Flibarchive.git rpm: Calculate huge header sizes correctly (#2158) If an RPM file contains a huge header which is larger than 4 GB then libarchive starts parsing the RPM header as actual archive instead of skipping it. Switched to uint64_t from size_t for proper 32 bit support as well. --- diff --git a/libarchive/archive_read_support_filter_rpm.c b/libarchive/archive_read_support_filter_rpm.c index 87e9f2ec1..44b5ba0a8 100644 --- a/libarchive/archive_read_support_filter_rpm.c +++ b/libarchive/archive_read_support_filter_rpm.c @@ -39,8 +39,8 @@ struct rpm { int64_t total_in; - size_t hpos; - size_t hlen; + uint64_t hpos; + uint64_t hlen; unsigned char header[16]; enum { ST_LEAD, /* Skipping 'Lead' section. */ @@ -161,9 +161,9 @@ rpm_filter_read(struct archive_read_filter *self, const void **buff) struct rpm *rpm; const unsigned char *b; ssize_t avail_in, total; - size_t used, n; - uint32_t section; - uint32_t bytes; + uint64_t used, n; + uint64_t section; + uint64_t bytes; rpm = (struct rpm *)self->data; *buff = NULL;