From d259e194df12569c8fe286eacd285be28118ecd7 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Sat, 7 Nov 2026 06:22:11 +0000 Subject: automatic import of zlib --- ...p-Fix-being-unable-to-open-empty-zip-file.patch | 160 +++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 backport-minizip-Fix-being-unable-to-open-empty-zip-file.patch (limited to 'backport-minizip-Fix-being-unable-to-open-empty-zip-file.patch') diff --git a/backport-minizip-Fix-being-unable-to-open-empty-zip-file.patch b/backport-minizip-Fix-being-unable-to-open-empty-zip-file.patch new file mode 100644 index 0000000..f574468 --- /dev/null +++ b/backport-minizip-Fix-being-unable-to-open-empty-zip-file.patch @@ -0,0 +1,160 @@ +From f209ca7be7981dc8fca79428706057e4ebc929ee Mon Sep 17 00:00:00 2001 +From: RedworkDE <10944644+RedworkDE@users.noreply.github.com> +Date: Wed, 15 Feb 2023 12:25:33 +0100 +Subject: [PATCH] minizip: Fix being unable to open empty zip file + +Reference:https://github.com/madler/zlib/commit/f209ca7be7981dc8fca79428706057e4ebc929ee +Conflict:NA +--- + contrib/minizip/unzip.c | 48 ++++++++++++++++++++++------------------- + 1 file changed, 26 insertions(+), 22 deletions(-) + +diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c +index ad2eb3bc9..3adc692f3 100644 +--- a/contrib/minizip/unzip.c ++++ b/contrib/minizip/unzip.c +@@ -379,6 +379,10 @@ extern int ZEXPORT unzStringFileNameCompare (const char* fileName1, + #define BUFREADCOMMENT (0x400) + #endif + ++#ifndef CENTRALDIRINVALID ++#define CENTRALDIRINVALID ((ZPOS64_T)(-1)) ++#endif ++ + /* + Locate the Central directory of a zipfile (at the end, just before + the global comment) +@@ -388,10 +392,10 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f + ZPOS64_T uSizeFile; + ZPOS64_T uBackRead; + ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ +- ZPOS64_T uPosFound=0; ++ ZPOS64_T uPosFound=CENTRALDIRINVALID; + + if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) +- return 0; ++ return CENTRALDIRINVALID; + + + uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); +@@ -401,7 +405,7 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f + + buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); + if (buf==NULL) +- return 0; ++ return CENTRALDIRINVALID; + + uBackRead = 4; + while (uBackRead