summaryrefslogtreecommitdiff
path: root/backport-Fix-decision-on-the-emission-of-Zip64-end-records-in.patch
diff options
context:
space:
mode:
Diffstat (limited to 'backport-Fix-decision-on-the-emission-of-Zip64-end-records-in.patch')
-rw-r--r--backport-Fix-decision-on-the-emission-of-Zip64-end-records-in.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/backport-Fix-decision-on-the-emission-of-Zip64-end-records-in.patch b/backport-Fix-decision-on-the-emission-of-Zip64-end-records-in.patch
new file mode 100644
index 0000000..a2a8435
--- /dev/null
+++ b/backport-Fix-decision-on-the-emission-of-Zip64-end-records-in.patch
@@ -0,0 +1,35 @@
+From 15c45adb76e81a7e3a8a9e17b2a56eb90f668f44 Mon Sep 17 00:00:00 2001
+From: Mark Adler <madler@alumni.caltech.edu>
+Date: Tue, 7 Nov 2023 15:46:41 -0800
+Subject: [PATCH] Fix decision on the emission of Zip64 end records in minizip.
+
+The appnote says that if the number of entries in the end record
+is 0xffff, then the actual number of entries will be found in the
+Zip64 end record. Therefore if the number of entries is equal to
+0xffff, it can't be in the end record by itself, since that is an
+instruction to get the number from the Zip64 end record. This code
+would just store 0xffff in the end record in that case, not making
+a Zip64 end record. This commit fixes that.
+
+Reference: https://github.com/madler/zlib/commit/15c45adb76e81a7e3a8a9e17b2a56eb90f668f44
+Conflict: no
+---
+ contrib/minizip/zip.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c
+index 0446109..86be90b 100644
+--- a/contrib/minizip/zip.c
++++ b/contrib/minizip/zip.c
+@@ -1872,7 +1872,7 @@ extern int ZEXPORT zipClose(zipFile file, const char* global_comment) {
+ free_linkedlist(&(zi->central_dir));
+
+ pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
+- if(pos >= 0xffffffff || zi->number_entry > 0xFFFF)
++ if(pos >= 0xffffffff || zi->number_entry >= 0xFFFF)
+ {
+ ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream);
+ Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip);
+--
+2.33.0
+