[zlib] - resolves: #719139 Zlib fails to read zip64 files on 64-bit system

pschiffe pschiffe at fedoraproject.org
Tue Jan 10 22:17:56 UTC 2012


commit 812a7a91046488603707bb43b816e34f0ea5cb2b
Author: Peter Schiffer <pschiffe at redhat.com>
Date:   Tue Jan 10 23:17:17 2012 +0100

    - resolves: #719139
      Zlib fails to read zip64 files on 64-bit system

 zlib-1.2.5-zip64.patch |   59 ++++++++++++++++++++++++++++++++++++++++++++++++
 zlib.spec              |    8 +++++-
 2 files changed, 66 insertions(+), 1 deletions(-)
---
diff --git a/zlib-1.2.5-zip64.patch b/zlib-1.2.5-zip64.patch
new file mode 100644
index 0000000..2bc94de
--- /dev/null
+++ b/zlib-1.2.5-zip64.patch
@@ -0,0 +1,59 @@
+diff -ru zlib-1.2.5/contrib/minizip/ioapi.c zlib-1.2.5-patch/contrib/minizip/ioapi.c
+--- zlib-1.2.5/contrib/minizip/ioapi.c	2010-01-04 12:31:24.000000000 -0500
++++ zlib-1.2.5-patch/contrib/minizip/ioapi.c	2011-07-05 15:47:48.263474587 -0400
+@@ -47,7 +47,7 @@
+     else
+     {
+         uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
+-        if ((tell_uLong) == ((uLong)-1))
++        if ((tell_uLong) == MAXU32)
+             return (ZPOS64_T)-1;
+         else
+             return tell_uLong;
+diff -ru zlib-1.2.5/contrib/minizip/ioapi.h zlib-1.2.5-patch/contrib/minizip/ioapi.h
+--- zlib-1.2.5/contrib/minizip/ioapi.h	2010-02-15 06:59:40.000000000 -0500
++++ zlib-1.2.5-patch/contrib/minizip/ioapi.h	2011-07-05 15:48:36.281546917 -0400
+@@ -85,6 +85,8 @@
+ typedef uint64_t ZPOS64_T;
+ #else
+ 
++/* Maximum unsigned 32-bit value used as placeholder for zip64 */
++#define MAXU32 0xffffffff
+ 
+ #if defined(_MSC_VER) || defined(__BORLANDC__)
+ typedef unsigned __int64 ZPOS64_T;
+diff -ru zlib-1.2.5/contrib/minizip/unzip.c zlib-1.2.5-patch/contrib/minizip/unzip.c
+--- zlib-1.2.5/contrib/minizip/unzip.c	2010-02-15 06:59:40.000000000 -0500
++++ zlib-1.2.5-patch/contrib/minizip/unzip.c	2011-07-05 15:50:31.409310349 -0400
+@@ -1040,26 +1040,26 @@
+             {
+                                                         uLong uL;
+ 
+-                                                                if(file_info.uncompressed_size == (ZPOS64_T)(unsigned long)-1)
++                                                                if(file_info.uncompressed_size == MAXU32)
+                                                                 {
+                                                                         if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
+                                                                                         err=UNZ_ERRNO;
+                                                                 }
+ 
+-                                                                if(file_info.compressed_size == (ZPOS64_T)(unsigned long)-1)
++                                                                if(file_info.compressed_size == MAXU32)
+                                                                 {
+                                                                         if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
+                                                                                   err=UNZ_ERRNO;
+                                                                 }
+ 
+-                                                                if(file_info_internal.offset_curfile == (ZPOS64_T)(unsigned long)-1)
++                                                                if(file_info_internal.offset_curfile == MAXU32)
+                                                                 {
+                                                                         /* Relative Header offset */
+                                                                         if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
+                                                                                 err=UNZ_ERRNO;
+                                                                 }
+ 
+-                                                                if(file_info.disk_num_start == (unsigned long)-1)
++                                                                if(file_info.disk_num_start == MAXU32)
+                                                                 {
+                                                                         /* Disk Start Number */
+                                                                         if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
+
diff --git a/zlib.spec b/zlib.spec
index ed17d90..c7c0934 100644
--- a/zlib.spec
+++ b/zlib.spec
@@ -1,7 +1,7 @@
 Summary: The zlib compression and decompression library
 Name: zlib
 Version: 1.2.5
-Release: 5%{?dist}
+Release: 6%{?dist}
 Group: System Environment/Libraries
 Source: http://www.zlib.net/zlib-%{version}.tar.bz2
 Patch3: zlib-1.2.4-autotools.patch
@@ -9,6 +9,7 @@ Patch3: zlib-1.2.4-autotools.patch
 Patch4: zlib-1.2.5-gentoo.patch
 Patch5: minizip-null.patch
 Patch6: zlib-1.2.5-minizip-fixuncrypt.patch
+Patch7: zlib-1.2.5-zip64.patch
 URL: http://www.gzip.org/zlib/
 # /contrib/dotzlib/ have Boost license
 License: zlib and Boost
@@ -64,6 +65,7 @@ developing applications which use minizip.
 %patch4 -p1 -b .g
 %patch5 -p1 -b .null
 %patch6 -p1 -b .fixuncrypt
+%patch7 -p1 -b .zip64
 # patch cannot create an empty dir
 mkdir contrib/minizip/m4
 cp minigzip.c contrib/minizip
@@ -143,6 +145,10 @@ rm -rf ${RPM_BUILD_ROOT}
 %{_libdir}/pkgconfig/minizip.pc
 
 %changelog
+* Tue Jan 10 2012 Peter Schiffer <pschiffe at redhat.com> - 1.2.5-6
+- resolves: #719139
+  Zlib fails to read zip64 files on 64-bit system
+
 * Fri Nov 11 2011 Tom Callaway <spot at fedoraproject.org> - 1.2.5-5
 - fix minizip to permit uncrypt when NOUNCRYPT is not defined
 


More information about the scm-commits mailing list