summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2023-11-07 15:46:41 -0800
committerMark Adler <madler@alumni.caltech.edu>2023-11-07 15:46:41 -0800
commit15c45adb76e81a7e3a8a9e17b2a56eb90f668f44 (patch)
tree598966f8566e411f758c1af061f282981385e42e
parentac8f12c97d1afd9bafa9c710f827d40a407d3266 (diff)
downloadzlib-15c45adb76e81a7e3a8a9e17b2a56eb90f668f44.tar.gz
zlib-15c45adb76e81a7e3a8a9e17b2a56eb90f668f44.tar.bz2
zlib-15c45adb76e81a7e3a8a9e17b2a56eb90f668f44.zip
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.
-rw-r--r--contrib/minizip/zip.c2
1 files changed, 1 insertions, 1 deletions
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) {
1872 free_linkedlist(&(zi->central_dir)); 1872 free_linkedlist(&(zi->central_dir));
1873 1873
1874 pos = centraldir_pos_inzip - zi->add_position_when_writing_offset; 1874 pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
1875 if(pos >= 0xffffffff || zi->number_entry > 0xFFFF) 1875 if(pos >= 0xffffffff || zi->number_entry >= 0xFFFF)
1876 { 1876 {
1877 ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream); 1877 ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream);
1878 Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip); 1878 Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip);