Zlib fails to read zip64 files on 64-bit system
This commit is contained in:
Peter Schiffer 2012-01-10 23:17:17 +01:00
parent 64704e73bc
commit 812a7a9104
2 changed files with 66 additions and 1 deletions

59
zlib-1.2.5-zip64.patch Normal file
View File

@ -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)

View File

@ -1,7 +1,7 @@
Summary: The zlib compression and decompression library Summary: The zlib compression and decompression library
Name: zlib Name: zlib
Version: 1.2.5 Version: 1.2.5
Release: 5%{?dist} Release: 6%{?dist}
Group: System Environment/Libraries Group: System Environment/Libraries
Source: http://www.zlib.net/zlib-%{version}.tar.bz2 Source: http://www.zlib.net/zlib-%{version}.tar.bz2
Patch3: zlib-1.2.4-autotools.patch 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 Patch4: zlib-1.2.5-gentoo.patch
Patch5: minizip-null.patch Patch5: minizip-null.patch
Patch6: zlib-1.2.5-minizip-fixuncrypt.patch Patch6: zlib-1.2.5-minizip-fixuncrypt.patch
Patch7: zlib-1.2.5-zip64.patch
URL: http://www.gzip.org/zlib/ URL: http://www.gzip.org/zlib/
# /contrib/dotzlib/ have Boost license # /contrib/dotzlib/ have Boost license
License: zlib and Boost License: zlib and Boost
@ -64,6 +65,7 @@ developing applications which use minizip.
%patch4 -p1 -b .g %patch4 -p1 -b .g
%patch5 -p1 -b .null %patch5 -p1 -b .null
%patch6 -p1 -b .fixuncrypt %patch6 -p1 -b .fixuncrypt
%patch7 -p1 -b .zip64
# patch cannot create an empty dir # patch cannot create an empty dir
mkdir contrib/minizip/m4 mkdir contrib/minizip/m4
cp minigzip.c contrib/minizip cp minigzip.c contrib/minizip
@ -143,6 +145,10 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/pkgconfig/minizip.pc %{_libdir}/pkgconfig/minizip.pc
%changelog %changelog
* Tue Jan 10 2012 Peter Schiffer <pschiffe@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@fedoraproject.org> - 1.2.5-5 * Fri Nov 11 2011 Tom Callaway <spot@fedoraproject.org> - 1.2.5-5
- fix minizip to permit uncrypt when NOUNCRYPT is not defined - fix minizip to permit uncrypt when NOUNCRYPT is not defined