Index: third_party/zlib/contrib/minizip/zip.c |
diff --git a/third_party/zlib/contrib/minizip/zip.c b/third_party/zlib/contrib/minizip/zip.c |
index 5a828851f4e92d9b8c35e40e6b5b5ea10610c075..aaf6961a99873fad4cd7377b16b531abf5c9f264 100644 |
--- a/third_party/zlib/contrib/minizip/zip.c |
+++ b/third_party/zlib/contrib/minizip/zip.c |
@@ -157,7 +157,7 @@ typedef struct |
ZPOS64_T totalUncompressedData; |
#ifndef NOCRYPT |
unsigned long keys[3]; /* keys defining the pseudo-random sequence */ |
- const unsigned long* pcrc_32_tab; |
+ const z_crc_t* pcrc_32_tab; |
int crypt_header_size; |
#endif |
} curfile64_info; |
@@ -1067,6 +1067,7 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, |
int err = ZIP_OK; |
# ifdef NOCRYPT |
+ (crcForCrypting); |
if (password != NULL) |
return ZIP_PARAMERROR; |
# endif |
@@ -1114,9 +1115,9 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, |
zi->ci.flag = flagBase; |
if ((level==8) || (level==9)) |
zi->ci.flag |= 2; |
- if ((level==2)) |
+ if (level==2) |
zi->ci.flag |= 4; |
- if ((level==1)) |
+ if (level==1) |
zi->ci.flag |= 6; |
if (password != NULL) |
zi->ci.flag |= 1; |
@@ -1710,7 +1711,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s |
if (err==ZIP_OK) |
err = zip64local_putValue(&zi->z_filefunc,zi->filestream,crc32,4); /* crc 32, unknown */ |
- if(uncompressed_size >= 0xffffffff) |
+ if(uncompressed_size >= 0xffffffff || compressed_size >= 0xffffffff ) |
{ |
if(zi->ci.pos_zip64extrainfo > 0) |
{ |
@@ -1724,6 +1725,8 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s |
if (err==ZIP_OK) /* uncompressed size, unknown */ |
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, compressed_size, 8); |
} |
+ else |
+ err = ZIP_BADZIPFILE; // Caller passed zip64 = 0, so no room for zip64 info -> fatal |
} |
else |
{ |
@@ -1852,7 +1855,7 @@ int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, |
err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)0xffffffff,4); |
} |
else |
- err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)(centraldir_pos_inzip - zi->add_position_when_writting_offset),4); |
+ err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)(centraldir_pos_inzip - zi->add_position_when_writting_offset),4); |
} |
return err; |
@@ -1919,7 +1922,7 @@ extern int ZEXPORT zipClose (zipFile file, const char* global_comment) |
free_linkedlist(&(zi->central_dir)); |
pos = centraldir_pos_inzip - zi->add_position_when_writting_offset; |
- if(pos >= 0xffffffff) |
+ if(pos >= 0xffffffff || zi->number_entry > 0xFFFF) |
{ |
ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream); |
Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip); |