commit f3ace98803035b8425d127fb3d874dafe0b9475a Author: Che-yu Wu Date: Mon Aug 6 14:09:22 2018 +0000 Enable traditional PKWARE decryption in zlib/contrib/minizip. Remove the #define which enables NOUNCRYPT by default. Correct the value of rest_read_compressed when decompressing an encrypted zip. Bug: crbug.com/869541 Change-Id: Ia86c1d234a8193f405147d35ad05c29fe86f812d Reviewed-on: https://chromium-review.googlesource.com/1161109 Reviewed-by: Chris Blume Commit-Queue: Che-yu Wu Cr-Commit-Position: refs/heads/master@{#580862} diff --git a/third_party/zlib/contrib/minizip/unzip.c b/third_party/zlib/contrib/minizip/unzip.c index 82275d6c1775d..c8a01b23efd42 100644 --- a/third_party/zlib/contrib/minizip/unzip.c +++ b/third_party/zlib/contrib/minizip/unzip.c @@ -1502,6 +1498,7 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method, zdecode(s->keys,s->pcrc_32_tab,source[i]); s->pfile_in_zip_read->pos_in_zipfile+=12; + s->pfile_in_zip_read->rest_read_compressed-=12; s->encrypted=1; } # endif commit 874ed6b46a4f75407829e510db77cc673a4c86e7 Author: Hans Wennborg Date: Mon Jun 15 11:33:46 2026 +0200 Check LFH / CD encryption flag consistency unz64local_CheckCurrentFileCoherencyHeader performs various consistency checks on the values in the Local File Header and Central Directory. Make it check the encryption flag as well. Bug: 514461031 Change-Id: Ifaf8620c6e0c345118712bce6e1206bbb83b3a2d Reviewed-on: https://chromium-review.googlesource.com/7942389 diff --git a/third_party/zlib/contrib/minizip/unzip.c b/third_party/zlib/contrib/minizip/unzip.c index 0264f7ac570f7..4eb0de302cfdf 100644 --- a/third_party/zlib/contrib/minizip/unzip.c +++ b/third_party/zlib/contrib/minizip/unzip.c @@ -1439,6 +1439,8 @@ local int unz64local_CheckCurrentFileCoherencyHeader(unz64_s* s, uInt* piSizeVar */ if (unz64local_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK) err=UNZ_ERRNO; + else if ((err==UNZ_OK) && ((uFlags & 1) != (s->cur_file_info.flag & 1))) + err=UNZ_BADZIPFILE; /* LFH/CD encryption flag mismatch */ if (unz64local_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) err=UNZ_ERRNO;