xref: /aosp_15_r20/external/zlib/patches/0014-minizip-unzip-with-incorrect-size.patch (revision 86ee64e75fa5f8bce2c8c356138035642429cd05)
1commit 764f0715d75c8d49339aa73d0ee2feb75d63473f
2Author: [email protected] <[email protected]@0039d316-1c4b-4281-b951-d872f2087c98>
3Date:   Wed May 7 20:53:02 2014 +0000
4
5    Fixed uncompressing files with wrong uncompressed size set.
6
7    A zip file carries some metadata for each archived file, including the total
8    uncompressed size. If that size was incorrect, therefore the compressed file
9    being different in size when unpacking, the minizip code would fail with a
10    CRC error. Every other zip utility handles these files, so should the minizip
11    code for safety sake.
12
13    BUG=359516
14
15    Review URL: https://codereview.chromium.org/222243003
16
17    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268940 0039d316-1c4b-4281-b951-d872f2087c98
18
19diff --git a/third_party/zlib/contrib/minizip/unzip.c b/third_party/zlib/contrib/minizip/unzip.c
20index ed763f89f1f87..82275d6c1775d 100644
21--- a/third_party/zlib/contrib/minizip/unzip.c
22+++ b/third_party/zlib/contrib/minizip/unzip.c
23@@ -1572,11 +1572,6 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) {
24
25     pfile_in_zip_read_info->stream.avail_out = (uInt)len;
26
27-    if ((len>pfile_in_zip_read_info->rest_read_uncompressed) &&
28-        (!(pfile_in_zip_read_info->raw)))
29-        pfile_in_zip_read_info->stream.avail_out =
30-            (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
31-
32     if ((len>pfile_in_zip_read_info->rest_read_compressed+
33            pfile_in_zip_read_info->stream.avail_in) &&
34          (pfile_in_zip_read_info->raw))
35