]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Feed at most UINT_MAX data to gzip.
authorEd Catmur <ed@catmur.uk>
Thu, 25 Apr 2019 19:55:40 +0000 (21:55 +0200)
committerMartin Matuska <martin@matuska.org>
Thu, 25 Apr 2019 21:07:19 +0000 (23:07 +0200)
Fixes #1169

libarchive/archive_read_support_filter_gzip.c

index cd24d2b1252d1312ce7f26d4d13047f22d5a8f1e..cbc1039a3aa4dcb9cecac0ee69733a653145d127 100644 (file)
@@ -37,6 +37,9 @@ __FBSDID("$FreeBSD$");
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -440,6 +443,8 @@ gzip_filter_read(struct archive_read_filter *self, const void **p)
                            "truncated gzip input");
                        return (ARCHIVE_FATAL);
                }
+               if (avail_in > UINT_MAX)
+                       avail_in = UINT_MAX;
                state->stream.avail_in = (uInt)avail_in;
 
                /* Decompress and consume some of that data. */