diff options
author | Elliott Hughes <enh@google.com> | 2024-01-23 00:11:46 +0000 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2024-01-23 00:11:46 +0000 |
commit | 76b49a3a72593a27f314aff65b3ebf8db2352918 (patch) | |
tree | fb2e71bbb824db2702d1eb1f530c1f6142df081a /patches | |
parent | 8dfcd22af5ffad0e16ec1023d0a189afd39c9b21 (diff) | |
parent | 63c0cec0344e6ba70f22bd690187088299baaa94 (diff) | |
download | zlib-76b49a3a72593a27f314aff65b3ebf8db2352918.tar.gz |
Upgrade zlib to 63c0cec0344e6ba70f22bd690187088299baaa94
This project was upgraded with external_updater.
Usage: tools/external_updater/updater.sh update zlib
For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md
Test: TreeHugger
Change-Id: I23d52b6301d2ed861155d66cdc9655f0eb06ba7d
Diffstat (limited to 'patches')
-rw-r--r-- | patches/0000-build.patch | 44 | ||||
-rw-r--r-- | patches/0004-fix-uwp.patch | 13 | ||||
-rw-r--r-- | patches/0008-minizip-zip-unzip-tools.patch | 55 | ||||
-rw-r--r-- | patches/0014-minizip-unzip-with-incorrect-size.patch | 34 | ||||
-rw-r--r-- | patches/0015-minizip-unzip-enable-decryption.patch | 39 | ||||
-rw-r--r-- | patches/0016-minizip-parse-unicode-path-extra-field.patch | 117 |
6 files changed, 243 insertions, 59 deletions
diff --git a/patches/0000-build.patch b/patches/0000-build.patch index 6119f09..1861194 100644 --- a/patches/0000-build.patch +++ b/patches/0000-build.patch @@ -1,43 +1,41 @@ +diff --git a/contrib/minizip/ioapi.c b/contrib/minizip/ioapi.c +index 782d32469ae5d..a38881dca90a2 100644 +--- a/contrib/minizip/ioapi.c ++++ b/contrib/minizip/ioapi.c +@@ -14,7 +14,7 @@ + #define _CRT_SECURE_NO_WARNINGS + #endif + +-#if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64) ++#if defined(__APPLE__) || defined(__Fuchsia__) || defined(IOAPI_NO_64) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64) + // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions + #define FOPEN_FUNC(filename, mode) fopen(filename, mode) + #define FTELLO_FUNC(stream) ftello(stream) diff --git a/contrib/minizip/iowin32.c b/contrib/minizip/iowin32.c -index 274f39eb1dd2..246ceb91a139 100644 +index 08536e94b8a28..bbd7773e67146 100644 --- a/contrib/minizip/iowin32.c +++ b/contrib/minizip/iowin32.c -@@ -26,12 +26,19 @@ +@@ -25,7 +25,12 @@ + #define INVALID_SET_FILE_POINTER ((DWORD)-1) #endif - +#ifdef _WIN32_WINNT +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x601 +#endif -+ + +#if _WIN32_WINNT >= _WIN32_WINNT_WIN8 // see Include/shared/winapifamily.h in the Windows Kit #if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) - #if WINAPI_FAMILY_ONE_PARTITION(WINAPI_FAMILY, WINAPI_PARTITION_APP) + +@@ -37,6 +42,7 @@ #define IOWIN32_USING_WINRT_API 1 #endif #endif +#endif - voidpf ZCALLBACK win32_open_file_func OF((voidpf opaque, const char* filename, int mode)); - uLong ZCALLBACK win32_read_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); -diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c -index bcfb9416ec35..199b4723fcfc 100644 ---- a/contrib/minizip/unzip.c -+++ b/contrib/minizip/unzip.c -@@ -1705,11 +1705,6 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) - - pfile_in_zip_read_info->stream.avail_out = (uInt)len; - -- if ((len>pfile_in_zip_read_info->rest_read_uncompressed) && -- (!(pfile_in_zip_read_info->raw))) -- pfile_in_zip_read_info->stream.avail_out = -- (uInt)pfile_in_zip_read_info->rest_read_uncompressed; -- - if ((len>pfile_in_zip_read_info->rest_read_compressed+ - pfile_in_zip_read_info->stream.avail_in) && - (pfile_in_zip_read_info->raw)) + typedef struct + { diff --git a/gzread.c b/gzread.c index 956b91ea7d9e..832d3ef98c59 100644 --- a/gzread.c diff --git a/patches/0004-fix-uwp.patch b/patches/0004-fix-uwp.patch index 23145a7..edef10a 100644 --- a/patches/0004-fix-uwp.patch +++ b/patches/0004-fix-uwp.patch @@ -1,14 +1,19 @@ diff --git a/third_party/zlib/contrib/minizip/iowin32.c b/third_party/zlib/contrib/minizip/iowin32.c -index 246ceb91a139..c6bc314b3c28 100644 +index bbd7773e67146..3f6867fd7e40b 100644 --- a/third_party/zlib/contrib/minizip/iowin32.c +++ b/third_party/zlib/contrib/minizip/iowin32.c -@@ -31,14 +31,12 @@ +@@ -30,19 +30,12 @@ #define _WIN32_WINNT 0x601 #endif -#if _WIN32_WINNT >= _WIN32_WINNT_WIN8 -// see Include/shared/winapifamily.h in the Windows Kit -#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) +- +-#if !defined(WINAPI_FAMILY_ONE_PARTITION) +-#define WINAPI_FAMILY_ONE_PARTITION(PartitionSet, Partition) ((WINAPI_FAMILY & PartitionSet) == Partition) +-#endif +- -#if WINAPI_FAMILY_ONE_PARTITION(WINAPI_FAMILY, WINAPI_PARTITION_APP) +#if !defined(IOWIN32_USING_WINRT_API) +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) @@ -18,5 +23,5 @@ index 246ceb91a139..c6bc314b3c28 100644 #endif -#endif - voidpf ZCALLBACK win32_open_file_func OF((voidpf opaque, const char* filename, int mode)); - uLong ZCALLBACK win32_read_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); + typedef struct + { diff --git a/patches/0008-minizip-zip-unzip-tools.patch b/patches/0008-minizip-zip-unzip-tools.patch index 48ceb02..273a8c9 100644 --- a/patches/0008-minizip-zip-unzip-tools.patch +++ b/patches/0008-minizip-zip-unzip-tools.patch @@ -9,13 +9,13 @@ Subject: [PATCH] Build minizip zip and unzip tools 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/third_party/zlib/contrib/minizip/miniunz.c b/third_party/zlib/contrib/minizip/miniunz.c -index 3d65401be5cd..08737f689a96 100644 +index 8ada038dbd4e7..5b4312e5647cd 100644 --- a/third_party/zlib/contrib/minizip/miniunz.c +++ b/third_party/zlib/contrib/minizip/miniunz.c @@ -12,7 +12,7 @@ Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) */ - + -#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) +#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) && (!defined(__ANDROID_API__)) #ifndef __USE_FILE_OFFSET64 @@ -24,32 +24,24 @@ index 3d65401be5cd..08737f689a96 100644 @@ -27,7 +27,7 @@ #endif #endif - --#ifdef __APPLE__ -+#if defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__) + +-#if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64) ++#if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64) || defined(__Fuchsia__) || defined(__ANDROID_API__) // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions #define FOPEN_FUNC(filename, mode) fopen(filename, mode) #define FTELLO_FUNC(stream) ftello(stream) -@@ -45,6 +45,7 @@ - #include <time.h> - #include <errno.h> - #include <fcntl.h> -+#include <sys/stat.h> - - #ifdef _WIN32 - # include <direct.h> -@@ -97,7 +98,7 @@ void change_file_date(filename,dosdate,tmu_date) +@@ -94,7 +94,7 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat SetFileTime(hFile,&ftm,&ftLastAcc,&ftm); CloseHandle(hFile); #else --#ifdef unix || __APPLE__ +-#if defined(unix) || defined(__APPLE__) +#if defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__) + (void)dosdate; struct utimbuf ut; struct tm newdate; - newdate.tm_sec = tmu_date.tm_sec; -@@ -125,11 +126,9 @@ int mymkdir(dirname) - const char* dirname; - { +@@ -125,11 +125,9 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat + + static int mymkdir(const char* dirname) { int ret=0; -#ifdef _WIN32 +#if defined(_WIN32) @@ -59,16 +51,16 @@ index 3d65401be5cd..08737f689a96 100644 -#elif __APPLE__ +#elif defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__) ret = mkdir (dirname,0775); - #endif - return ret; + #else + (void)dirname; diff --git a/third_party/zlib/contrib/minizip/minizip.c b/third_party/zlib/contrib/minizip/minizip.c -index 4288962ecef0..b794953c5c23 100644 +index 26ee8d029efe6..9eb3956a55e00 100644 --- a/third_party/zlib/contrib/minizip/minizip.c +++ b/third_party/zlib/contrib/minizip/minizip.c @@ -12,8 +12,7 @@ Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) */ - + - -#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) +#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) && (!defined(__ANDROID_API__)) @@ -78,21 +70,20 @@ index 4288962ecef0..b794953c5c23 100644 @@ -28,7 +27,7 @@ #endif #endif - --#ifdef __APPLE__ -+#if defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__) + +-#if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64) ++#if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64) || defined(__Fuchsia__) || defined(__ANDROID_API__) // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions #define FOPEN_FUNC(filename, mode) fopen(filename, mode) #define FTELLO_FUNC(stream) ftello(stream) -@@ -94,7 +93,7 @@ uLong filetime(f, tmzip, dt) +@@ -92,7 +91,7 @@ static int filetime(const char *f, tm_zip *tmzip, uLong *dt) { return ret; } #else --#ifdef unix || __APPLE__ +-#if defined(unix) || defined(__APPLE__) +#if defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__) - uLong filetime(f, tmzip, dt) - char *f; /* name of file to get info on */ - tm_zip *tmzip; /* return value: access, modific. and creation times */ + /* f: name of file to get info on, tmzip: return value: access, + modification and creation times, dt: dostime */ + static int filetime(const char *f, tm_zip *tmzip, uLong *dt) { -- 2.31.1.818.g46aad6cb9e-goog - diff --git a/patches/0014-minizip-unzip-with-incorrect-size.patch b/patches/0014-minizip-unzip-with-incorrect-size.patch new file mode 100644 index 0000000..5ede561 --- /dev/null +++ b/patches/0014-minizip-unzip-with-incorrect-size.patch @@ -0,0 +1,34 @@ +commit 764f0715d75c8d49339aa73d0ee2feb75d63473f +Author: joaoe@opera.com <joaoe@opera.com@0039d316-1c4b-4281-b951-d872f2087c98> +Date: Wed May 7 20:53:02 2014 +0000 + + Fixed uncompressing files with wrong uncompressed size set. + + A zip file carries some metadata for each archived file, including the total + uncompressed size. If that size was incorrect, therefore the compressed file + being different in size when unpacking, the minizip code would fail with a + CRC error. Every other zip utility handles these files, so should the minizip + code for safety sake. + + BUG=359516 + + Review URL: https://codereview.chromium.org/222243003 + + git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268940 0039d316-1c4b-4281-b951-d872f2087c98 + +diff --git a/third_party/zlib/contrib/minizip/unzip.c b/third_party/zlib/contrib/minizip/unzip.c +index ed763f89f1f87..82275d6c1775d 100644 +--- a/third_party/zlib/contrib/minizip/unzip.c ++++ b/third_party/zlib/contrib/minizip/unzip.c +@@ -1572,11 +1572,6 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) { + + pfile_in_zip_read_info->stream.avail_out = (uInt)len; + +- if ((len>pfile_in_zip_read_info->rest_read_uncompressed) && +- (!(pfile_in_zip_read_info->raw))) +- pfile_in_zip_read_info->stream.avail_out = +- (uInt)pfile_in_zip_read_info->rest_read_uncompressed; +- + if ((len>pfile_in_zip_read_info->rest_read_compressed+ + pfile_in_zip_read_info->stream.avail_in) && + (pfile_in_zip_read_info->raw)) diff --git a/patches/0015-minizip-unzip-enable-decryption.patch b/patches/0015-minizip-unzip-enable-decryption.patch new file mode 100644 index 0000000..966e83c --- /dev/null +++ b/patches/0015-minizip-unzip-enable-decryption.patch @@ -0,0 +1,39 @@ +commit f3ace98803035b8425d127fb3d874dafe0b9475a +Author: Che-yu Wu <cheyuw@google.com> +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 <cblume@chromium.org> + Commit-Queue: Che-yu Wu <cheyuw@google.com> + 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 +@@ -68,10 +68,6 @@ + #include <stdlib.h> + #include <string.h> + +-#ifndef NOUNCRYPT +- #define NOUNCRYPT +-#endif +- + #include "zlib.h" + #include "unzip.h" + +@@ -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 diff --git a/patches/0016-minizip-parse-unicode-path-extra-field.patch b/patches/0016-minizip-parse-unicode-path-extra-field.patch new file mode 100644 index 0000000..9a99a8a --- /dev/null +++ b/patches/0016-minizip-parse-unicode-path-extra-field.patch @@ -0,0 +1,117 @@ +commit c8834821f452a3d424edd0ed2a1e9ceeda38d0ea +Author: Alex Danilo <adanilo@chromium.org> +Date: Thu May 12 03:29:52 2022 +0000 + + Extract: Parse Unicode Path Extra field in minizip + + Adds parsing of the Info-ZIP Extra field which overrides the + file name in the File Header only if the CRC in the extra field + is a CRC of the file name in the File Header. + + See https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT + section 4.6.9 for reference. + + Also tidied up some whitespace indent. + + Bug: 953256, 953599 + Tests: Manually tested, auto test in follow on CL + Change-Id: I1283dcb88a203c3bb56c1d9c504035a2e51aecbd + Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3641742 + Reviewed-by: Noel Gordon <noel@chromium.org> + Commit-Queue: Alex Danilo <adanilo@chromium.org> + Cr-Commit-Position: refs/heads/main@{#1002476} + +diff --git a/third_party/zlib/contrib/minizip/unzip.c b/third_party/zlib/contrib/minizip/unzip.c +index c8a01b23efd42..42677cff82c96 100644 +--- a/third_party/zlib/contrib/minizip/unzip.c ++++ b/third_party/zlib/contrib/minizip/unzip.c +@@ -193,6 +193,26 @@ typedef struct + Reads a long in LSB order from the given gz_stream. Sets + */ + ++local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, ++ voidpf filestream, ++ int *pi) { ++ unsigned char c; ++ int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1); ++ if (err==1) ++ { ++ *pi = (int)c; ++ return UNZ_OK; ++ } ++ else ++ { ++ *pi = 0; ++ if (ZERROR64(*pzlib_filefunc_def,filestream)) ++ return UNZ_ERRNO; ++ else ++ return UNZ_EOF; ++ } ++} ++ + local int unz64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def, + voidpf filestream, + uLong *pX) { +@@ -948,6 +968,62 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file, + } + + } ++ else if (headerId == 0x7075) /* Info-ZIP Unicode Path Extra Field */ ++ { ++ int version = 0; ++ ++ if (unz64local_getByte(&s->z_filefunc, s->filestream, &version) != UNZ_OK) ++ { ++ err = UNZ_ERRNO; ++ } ++ if (version != 1) ++ { ++ if (ZSEEK64(s->z_filefunc, s->filestream,dataSize - 1, ZLIB_FILEFUNC_SEEK_CUR) != 0) ++ { ++ err = UNZ_ERRNO; ++ } ++ } ++ else ++ { ++ uLong uCrc, uHeaderCrc, fileNameSize; ++ ++ if (unz64local_getLong(&s->z_filefunc, s->filestream, &uCrc) != UNZ_OK) ++ { ++ err = UNZ_ERRNO; ++ } ++ uHeaderCrc = crc32(0, (const unsigned char *)szFileName, file_info.size_filename); ++ fileNameSize = dataSize - (2 * sizeof (short) + 1); ++ /* Check CRC against file name in the header. */ ++ if (uHeaderCrc != uCrc) ++ { ++ if (ZSEEK64(s->z_filefunc, s->filestream, fileNameSize, ZLIB_FILEFUNC_SEEK_CUR) != 0) ++ { ++ err = UNZ_ERRNO; ++ } ++ } ++ else ++ { ++ uLong uSizeRead; ++ ++ if (fileNameSize < fileNameBufferSize) ++ { ++ *(szFileName + fileNameSize) = '\0'; ++ uSizeRead = fileNameSize; ++ } ++ else ++ { ++ uSizeRead = fileNameBufferSize; ++ } ++ if ((fileNameSize > 0) && (fileNameBufferSize > 0)) ++ { ++ if (ZREAD64(s->z_filefunc, s->filestream, szFileName, uSizeRead) != uSizeRead) ++ { ++ err = UNZ_ERRNO; ++ } ++ } ++ } ++ } ++ } + else + { + if (ZSEEK64(s->z_filefunc, s->filestream,dataSize,ZLIB_FILEFUNC_SEEK_CUR)!=0) |