Fix large-entry detection in minizip on 64-bit systems [Schiffer].
This commit is contained in:
parent
eb33abcc55
commit
5a5dd2c793
@ -59,7 +59,7 @@ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
|
uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
|
||||||
if ((tell_uLong) == ((uLong)-1))
|
if ((tell_uLong) == MAXU32)
|
||||||
return (ZPOS64_T)-1;
|
return (ZPOS64_T)-1;
|
||||||
else
|
else
|
||||||
return tell_uLong;
|
return tell_uLong;
|
||||||
|
@ -86,6 +86,8 @@ typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
|
|||||||
typedef uint64_t ZPOS64_T;
|
typedef uint64_t ZPOS64_T;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
/* Maximum unsigned 32-bit value used as placeholder for zip64 */
|
||||||
|
#define MAXU32 0xffffffff
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||||
typedef unsigned __int64 ZPOS64_T;
|
typedef unsigned __int64 ZPOS64_T;
|
||||||
|
@ -1040,26 +1040,26 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
|||||||
{
|
{
|
||||||
uLong uL;
|
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)
|
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
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)
|
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file_info_internal.offset_curfile == (ZPOS64_T)(unsigned long)-1)
|
if(file_info_internal.offset_curfile == MAXU32)
|
||||||
{
|
{
|
||||||
/* Relative Header offset */
|
/* Relative Header offset */
|
||||||
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
|
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file_info.disk_num_start == (unsigned long)-1)
|
if(file_info.disk_num_start == MAXU32)
|
||||||
{
|
{
|
||||||
/* Disk Start Number */
|
/* Disk Start Number */
|
||||||
if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
|
if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user