From b9f713540cc33a66a44728dd706aea487b989913 Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Fri, 3 May 2024 23:41:35 +0200 Subject: [PATCH] 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. --- libarchive/archive_read_support_filter_rpm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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; -- 2.47.2