summaryrefslogtreecommitdiffstats
path: root/thirdparty/minizip/zip.c
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/minizip/zip.c')
-rw-r--r--thirdparty/minizip/zip.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/thirdparty/minizip/zip.c b/thirdparty/minizip/zip.c
index e859f9e42f..d76c643dfb 100644
--- a/thirdparty/minizip/zip.c
+++ b/thirdparty/minizip/zip.c
@@ -1045,6 +1045,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)