diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2012-01-16 13:16:39 -0800 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2012-01-16 16:44:40 -0800 |
commit | 5a5dd2c793df39a3e1765abc3dfcad0852bdf6cb (patch) | |
tree | 122d0a277d35aa167247650a641bc6263b75ca1f | |
parent | eb33abcc553dcd65ce1c4c7fc9d6bc096721d5bc (diff) | |
download | zlib-5a5dd2c793df39a3e1765abc3dfcad0852bdf6cb.tar.gz zlib-5a5dd2c793df39a3e1765abc3dfcad0852bdf6cb.tar.bz2 zlib-5a5dd2c793df39a3e1765abc3dfcad0852bdf6cb.zip |
Fix large-entry detection in minizip on 64-bit systems [Schiffer].
-rw-r--r-- | contrib/minizip/ioapi.c | 2 | ||||
-rw-r--r-- | contrib/minizip/ioapi.h | 2 | ||||
-rw-r--r-- | contrib/minizip/unzip.c | 8 |
3 files changed, 7 insertions, 5 deletions
diff --git a/contrib/minizip/ioapi.c b/contrib/minizip/ioapi.c index d4bc020..49ec64a 100644 --- a/contrib/minizip/ioapi.c +++ b/contrib/minizip/ioapi.c | |||
@@ -59,7 +59,7 @@ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream | |||
59 | else | 59 | else |
60 | { | 60 | { |
61 | uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream); | 61 | uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream); |
62 | if ((tell_uLong) == ((uLong)-1)) | 62 | if ((tell_uLong) == MAXU32) |
63 | return (ZPOS64_T)-1; | 63 | return (ZPOS64_T)-1; |
64 | else | 64 | else |
65 | return tell_uLong; | 65 | return tell_uLong; |
diff --git a/contrib/minizip/ioapi.h b/contrib/minizip/ioapi.h index f6dce26..b5c9f93 100644 --- a/contrib/minizip/ioapi.h +++ b/contrib/minizip/ioapi.h | |||
@@ -86,6 +86,8 @@ typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T; | |||
86 | typedef uint64_t ZPOS64_T; | 86 | typedef uint64_t ZPOS64_T; |
87 | #else | 87 | #else |
88 | 88 | ||
89 | /* Maximum unsigned 32-bit value used as placeholder for zip64 */ | ||
90 | #define MAXU32 0xffffffff | ||
89 | 91 | ||
90 | #if defined(_MSC_VER) || defined(__BORLANDC__) | 92 | #if defined(_MSC_VER) || defined(__BORLANDC__) |
91 | typedef unsigned __int64 ZPOS64_T; | 93 | typedef unsigned __int64 ZPOS64_T; |
diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c index 587a2a1..050014c 100644 --- a/contrib/minizip/unzip.c +++ b/contrib/minizip/unzip.c | |||
@@ -1040,26 +1040,26 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, | |||
1040 | { | 1040 | { |
1041 | uLong uL; | 1041 | uLong uL; |
1042 | 1042 | ||
1043 | if(file_info.uncompressed_size == (ZPOS64_T)(unsigned long)-1) | 1043 | if(file_info.uncompressed_size == MAXU32) |
1044 | { | 1044 | { |
1045 | if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK) | 1045 | if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK) |
1046 | err=UNZ_ERRNO; | 1046 | err=UNZ_ERRNO; |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | if(file_info.compressed_size == (ZPOS64_T)(unsigned long)-1) | 1049 | if(file_info.compressed_size == MAXU32) |
1050 | { | 1050 | { |
1051 | if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK) | 1051 | if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK) |
1052 | err=UNZ_ERRNO; | 1052 | err=UNZ_ERRNO; |
1053 | } | 1053 | } |
1054 | 1054 | ||
1055 | if(file_info_internal.offset_curfile == (ZPOS64_T)(unsigned long)-1) | 1055 | if(file_info_internal.offset_curfile == MAXU32) |
1056 | { | 1056 | { |
1057 | /* Relative Header offset */ | 1057 | /* Relative Header offset */ |
1058 | if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK) | 1058 | if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK) |
1059 | err=UNZ_ERRNO; | 1059 | err=UNZ_ERRNO; |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | if(file_info.disk_num_start == (unsigned long)-1) | 1062 | if(file_info.disk_num_start == MAXU32) |
1063 | { | 1063 | { |
1064 | /* Disk Start Number */ | 1064 | /* Disk Start Number */ |
1065 | if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) | 1065 | if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) |