minizip prevent issues fixes
authorLukasz Marek <l.marek@samsung.com>
Fri, 1 Feb 2013 16:09:44 +0000 (17:09 +0100)
committerGerrit Code Review <gerrit2@kim11>
Mon, 4 Feb 2013 08:36:53 +0000 (17:36 +0900)
[Issue#] N/A
[Problem] Prevent issued some core in minizip module
[Cause] N/A
[Solution] Fixed

Change-Id: I2f1b01ba750a0d0f3ece0208c7919e71fc3d9273

3rdparty/minizip/ioapi.c
3rdparty/minizip/minizip.c
3rdparty/minizip/mztools.c
3rdparty/minizip/unzip.c
3rdparty/minizip/unzip11.zip [deleted file]
3rdparty/minizip/zip.c

index 49958f6..41ab314 100644 (file)
@@ -22,6 +22,8 @@ voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename
         return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);
     else
     {
+        if (pfilefunc->zopen32_file == NULL)
+            return NULL;
         return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode);
     }
 }
@@ -33,7 +35,7 @@ long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZP
     else
     {
         uLong offsetTruncated = (uLong)offset;
-        if (offsetTruncated != offset)
+        if (offsetTruncated != offset || pfilefunc->zseek32_file == NULL)
             return -1;
         else
             return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin);
@@ -46,6 +48,8 @@ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream
         return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
     else
     {
+        if (pfilefunc->ztell32_file == NULL)
+            return (ZPOS64_T)-1;
         uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
         if ((tell_uLong) == ((uLong)-1))
             return (ZPOS64_T)-1;
index 7a4fa5a..a0a327b 100644 (file)
@@ -382,7 +382,7 @@ int main(argc,argv)
                    ((argv[i][1]>='0') || (argv[i][1]<='9'))) &&
                   (strlen(argv[i]) == 2)))
             {
-                FILE * fin;
+                FILE * fin = NULL;
                 int size_read;
                 const char* filenameinzip = argv[i];
                 const char *savefilenameinzip;
index f9092e6..edf6b7f 100644 (file)
@@ -41,7 +41,7 @@ uLong* bytesRecovered;
   if (fpZip != NULL &&  fpOut != NULL) {
     int entries = 0;
     uLong totalBytes = 0;
-    char header[30];
+    char header[30] = {0,};
     char filename[256];
     char extra[1024];
     int offset = 0;
index 7617f41..27ce758 100644 (file)
@@ -585,8 +585,8 @@ local unzFile unzOpenInternal (const void *path,
                                zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
                                int is64bitOpenFunction)
 {
-    unz64_s us;
-    unz64_s *s;
+    unz64_s us = {0, };
+    unz64_s *s = NULL;
     ZPOS64_T central_pos;
     uLong   uL;
 
@@ -782,6 +782,7 @@ extern unzFile ZEXPORT unzOpen2_64 (const void *path,
     {
         zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
         zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;
+        zlib_filefunc64_32_def_fill.zopen32_file = NULL;
         zlib_filefunc64_32_def_fill.ztell32_file = NULL;
         zlib_filefunc64_32_def_fill.zseek32_file = NULL;
         return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 1);
diff --git a/3rdparty/minizip/unzip11.zip b/3rdparty/minizip/unzip11.zip
deleted file mode 100644 (file)
index fe55dc3..0000000
Binary files a/3rdparty/minizip/unzip11.zip and /dev/null differ
index 3c34fc8..96b2ba3 100644 (file)
@@ -935,6 +935,7 @@ extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc*
     {
         zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
         zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;
+        zlib_filefunc64_32_def_fill.zopen32_file = NULL;
         zlib_filefunc64_32_def_fill.ztell32_file = NULL;
         zlib_filefunc64_32_def_fill.zseek32_file = NULL;
         return zipOpen3(pathname, append, globalcomment, &zlib_filefunc64_32_def_fill);