]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
rpm: Calculate huge header sizes correctly (#2158)
authorTobias Stoeckmann <stoeckmann@users.noreply.github.com>
Fri, 3 May 2024 21:41:35 +0000 (23:41 +0200)
committerGitHub <noreply@github.com>
Fri, 3 May 2024 21:41:35 +0000 (14:41 -0700)
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

index 87e9f2ec19393eb98def9a1a93053f407c57d74d..44b5ba0a88a3324b6f573481163a023fd1a2b368 100644 (file)
@@ -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;