diff options
author | Xavier Roche <roche@httrack.com> | 2024-01-27 14:12:35 +0100 |
---|---|---|
committer | Xavier Roche <roche@httrack.com> | 2024-01-27 14:22:41 +0100 |
commit | b625cfe82ab34374f3cad7ef3941a6c001fc4876 (patch) | |
tree | 620b602db9871b05c38ccf25603de638e40d11e0 | |
parent | 940bc759c9a26f70e75dc2af7ddbdeb6d72a3106 (diff) |
Upgraded to minizip 1.1 from zlib 1.3.1
closes:#272
-rw-r--r-- | src/minizip/MiniZip64_Changes.txt | 2 | ||||
-rw-r--r-- | src/minizip/ioapi.c.diff | 4 | ||||
-rw-r--r-- | src/minizip/ioapi.h | 2 | ||||
-rw-r--r-- | src/minizip/ioapi.h.diff | 4 | ||||
-rw-r--r-- | src/minizip/ioapi.h.orig | 2 | ||||
-rw-r--r-- | src/minizip/mztools.c.diff | 4 | ||||
-rw-r--r-- | src/minizip/unzip.c | 8 | ||||
-rw-r--r-- | src/minizip/unzip.h | 2 | ||||
-rw-r--r-- | src/minizip/zip.c | 10 | ||||
-rw-r--r-- | src/minizip/zip.c.diff | 8 | ||||
-rw-r--r-- | src/minizip/zip.c.orig | 21 | ||||
-rw-r--r-- | src/minizip/zip.h | 4 | ||||
-rw-r--r-- | src/minizip/zip.h.diff | 4 | ||||
-rw-r--r-- | src/minizip/zip.h.orig | 4 |
14 files changed, 45 insertions, 34 deletions
diff --git a/src/minizip/MiniZip64_Changes.txt b/src/minizip/MiniZip64_Changes.txt index 13a1bd9..3759468 100644 --- a/src/minizip/MiniZip64_Changes.txt +++ b/src/minizip/MiniZip64_Changes.txt @@ -1,5 +1,5 @@ -MiniZip 1.1 was derrived from MiniZip at version 1.01f +MiniZip 1.1 was derived from MiniZip at version 1.01f Change in 1.0 (Okt 2009) - **TODO - Add history** diff --git a/src/minizip/ioapi.c.diff b/src/minizip/ioapi.c.diff index ba93c23..1c02e01 100644 --- a/src/minizip/ioapi.c.diff +++ b/src/minizip/ioapi.c.diff @@ -1,5 +1,5 @@ ---- ioapi.c.orig 2023-11-17 16:21:50.355864777 +0000 -+++ ioapi.c 2023-11-17 16:21:50.355864777 +0000 +--- ioapi.c.orig 2024-01-27 14:07:18.636193212 +0100 ++++ ioapi.c 2024-01-27 14:09:48.372601229 +0100 @@ -14,7 +14,7 @@ #define _CRT_SECURE_NO_WARNINGS #endif diff --git a/src/minizip/ioapi.h b/src/minizip/ioapi.h index 0c45d72..f374095 100644 --- a/src/minizip/ioapi.h +++ b/src/minizip/ioapi.h @@ -166,7 +166,7 @@ typedef long (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream) typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin); -/* here is the "old" 32 bits structure structure */ +/* here is the "old" 32 bits structure */ typedef struct zlib_filefunc_def_s { open_file_func zopen_file; diff --git a/src/minizip/ioapi.h.diff b/src/minizip/ioapi.h.diff index 3c6b674..2d34631 100644 --- a/src/minizip/ioapi.h.diff +++ b/src/minizip/ioapi.h.diff @@ -1,5 +1,5 @@ ---- ioapi.h.orig 2023-11-17 16:21:50.359864777 +0000 -+++ ioapi.h 2023-11-17 16:24:00.239861504 +0000 +--- ioapi.h.orig 2024-01-27 14:07:18.636193212 +0100 ++++ ioapi.h 2024-01-27 14:09:46.028594897 +0100 @@ -21,6 +21,9 @@ #ifndef _ZLIBIOAPI64_H #define _ZLIBIOAPI64_H diff --git a/src/minizip/ioapi.h.orig b/src/minizip/ioapi.h.orig index c588a18..a2d2e6e 100644 --- a/src/minizip/ioapi.h.orig +++ b/src/minizip/ioapi.h.orig @@ -144,7 +144,7 @@ typedef long (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream) typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin); -/* here is the "old" 32 bits structure structure */ +/* here is the "old" 32 bits structure */ typedef struct zlib_filefunc_def_s { open_file_func zopen_file; diff --git a/src/minizip/mztools.c.diff b/src/minizip/mztools.c.diff index 255d6a1..ff2e656 100644 --- a/src/minizip/mztools.c.diff +++ b/src/minizip/mztools.c.diff @@ -1,5 +1,5 @@ ---- mztools.c.orig 2023-11-17 16:21:50.359864777 +0000 -+++ mztools.c 2023-11-17 16:25:28.087859290 +0000 +--- mztools.c.orig 2024-01-27 14:07:18.636193212 +0100 ++++ mztools.c 2024-01-27 14:09:55.356620093 +0100 @@ -10,6 +10,7 @@ #include <string.h> #include "zlib.h" diff --git a/src/minizip/unzip.c b/src/minizip/unzip.c index ed763f8..ea05b7d 100644 --- a/src/minizip/unzip.c +++ b/src/minizip/unzip.c @@ -117,7 +117,7 @@ const char unz_copyright[] = " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; -/* unz_file_info_interntal contain internal info about a file in zipfile*/ +/* unz_file_info64_internal contain internal info about a file in zipfile*/ typedef struct unz_file_info64_internal_s { ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */ @@ -450,7 +450,7 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; if (uL != 0) @@ -497,9 +497,9 @@ local unzFile unzOpenInternal(const void *path, ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry_CD; /* total number of entries in the central dir diff --git a/src/minizip/unzip.h b/src/minizip/unzip.h index 1410584..5cfc9c6 100644 --- a/src/minizip/unzip.h +++ b/src/minizip/unzip.h @@ -306,7 +306,7 @@ extern int ZEXPORT unzGetCurrentFileInfo(unzFile file, Get Info about the current file if pfile_info!=NULL, the *pfile_info structure will contain some info about the current file - if szFileName!=NULL, the filemane string will be copied in szFileName + if szFileName!=NULL, the filename string will be copied in szFileName (fileNameBufferSize is the size of the buffer) if extraField!=NULL, the extra field information will be copied in extraField (extraFieldBufferSize is the size of the buffer). diff --git a/src/minizip/zip.c b/src/minizip/zip.c index 8cc5b84..9dd00fe 100644 --- a/src/minizip/zip.c +++ b/src/minizip/zip.c @@ -575,7 +575,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; if (uL != 0) @@ -614,9 +614,9 @@ local int LoadCentralDirectoryRecord(zip64_internal* pziinit) { ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number of the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry; ZPOS64_T number_entry_CD; /* total number of entries in @@ -1608,7 +1608,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_si if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree) { - // we can not write more data to the buffer that we have room for. + // we cannot write more data to the buffer that we have room for. return ZIP_BADZIPFILE; } @@ -1884,7 +1884,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); diff --git a/src/minizip/zip.c.diff b/src/minizip/zip.c.diff index 8f96058..2b01cdf 100644 --- a/src/minizip/zip.c.diff +++ b/src/minizip/zip.c.diff @@ -1,6 +1,6 @@ ---- zip.c.orig 2023-11-17 16:21:50.363864777 +0000 -+++ zip.c 2023-11-17 16:26:04.671858368 +0000 -@@ -1401,7 +1401,7 @@ +--- zip.c.orig 2024-01-27 14:07:18.636193212 +0100 ++++ zip.c 2024-01-27 14:09:59.736631926 +0100 +@@ -1412,7 +1412,7 @@ else #endif { @@ -9,7 +9,7 @@ zi->ci.stream.avail_in = len; while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0)) -@@ -1819,6 +1819,18 @@ +@@ -1830,6 +1830,18 @@ return err; } diff --git a/src/minizip/zip.c.orig b/src/minizip/zip.c.orig index 3d3d4ca..60bdffa 100644 --- a/src/minizip/zip.c.orig +++ b/src/minizip/zip.c.orig @@ -575,7 +575,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; if (uL != 0) @@ -614,9 +614,9 @@ local int LoadCentralDirectoryRecord(zip64_internal* pziinit) { ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number of the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry; ZPOS64_T number_entry_CD; /* total number of entries in @@ -1043,6 +1043,17 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c return ZIP_PARAMERROR; #endif + // The filename and comment length must fit in 16 bits. + if ((filename!=NULL) && (strlen(filename)>0xffff)) + return ZIP_PARAMERROR; + if ((comment!=NULL) && (strlen(comment)>0xffff)) + return ZIP_PARAMERROR; + // The extra field length must fit in 16 bits. If the member also requires + // a Zip64 extra block, that will also need to fit within that 16-bit + // length, but that will be checked for later. + if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff)) + return ZIP_PARAMERROR; + zi = (zip64_internal*)file; if (zi->in_opened_file_inzip == 1) @@ -1597,7 +1608,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_si if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree) { - // we can not write more data to the buffer that we have room for. + // we cannot write more data to the buffer that we have room for. return ZIP_BADZIPFILE; } @@ -1861,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); diff --git a/src/minizip/zip.h b/src/minizip/zip.h index 87fa5b9..73715a5 100644 --- a/src/minizip/zip.h +++ b/src/minizip/zip.h @@ -177,9 +177,9 @@ extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, filename : the filename in zip (if NULL, '-' without quote will be used *zipfi contain supplemental information if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local - contains the extrafield data the the local header + contains the extrafield data for the local header if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global - contains the extrafield data the the local header + contains the extrafield data for the global header if comment != NULL, comment contain the comment string method contain the compression method (0 for store, Z_DEFLATED for deflate) level contain the level of compression (can be Z_DEFAULT_COMPRESSION) diff --git a/src/minizip/zip.h.diff b/src/minizip/zip.h.diff index 8c0725c..f19af4d 100644 --- a/src/minizip/zip.h.diff +++ b/src/minizip/zip.h.diff @@ -1,5 +1,5 @@ ---- zip.h.orig 2023-11-17 16:21:50.363864777 +0000 -+++ zip.h 2023-11-17 16:26:04.675858368 +0000 +--- zip.h.orig 2024-01-27 14:07:18.636193212 +0100 ++++ zip.h 2024-01-27 14:10:04.104643731 +0100 @@ -313,6 +313,11 @@ Write data in the zipfile */ diff --git a/src/minizip/zip.h.orig b/src/minizip/zip.h.orig index 5fc0841..3e230d3 100644 --- a/src/minizip/zip.h.orig +++ b/src/minizip/zip.h.orig @@ -177,9 +177,9 @@ extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, filename : the filename in zip (if NULL, '-' without quote will be used *zipfi contain supplemental information if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local - contains the extrafield data the the local header + contains the extrafield data for the local header if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global - contains the extrafield data the the local header + contains the extrafield data for the global header if comment != NULL, comment contain the comment string method contain the compression method (0 for store, Z_DEFLATED for deflate) level contain the level of compression (can be Z_DEFAULT_COMPRESSION) |