Merge 8ba317b180 into 0c30a001bc
This commit is contained in:
commit
780b61e597
25
miniz_zip.c
25
miniz_zip.c
@ -854,8 +854,7 @@ static int mz_stat64(const char *path, struct __stat64 *buffer)
|
|||||||
filename_size = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS);
|
filename_size = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS);
|
||||||
ext_data_size = MZ_READ_LE16(p + MZ_ZIP_CDH_EXTRA_LEN_OFS);
|
ext_data_size = MZ_READ_LE16(p + MZ_ZIP_CDH_EXTRA_LEN_OFS);
|
||||||
|
|
||||||
if ((!pZip->m_pState->m_zip64_has_extended_info_fields) &&
|
if ((ext_data_size) &&
|
||||||
(ext_data_size) &&
|
|
||||||
(MZ_MAX(MZ_MAX(comp_size, decomp_size), local_header_ofs) == MZ_UINT32_MAX))
|
(MZ_MAX(MZ_MAX(comp_size, decomp_size), local_header_ofs) == MZ_UINT32_MAX))
|
||||||
{
|
{
|
||||||
/* Attempt to find zip64 extended information field in the entry's extra data */
|
/* Attempt to find zip64 extended information field in the entry's extra data */
|
||||||
@ -916,7 +915,25 @@ static int mz_stat64(const char *path, struct __stat64 *buffer)
|
|||||||
pExtra_data += sizeof(mz_uint16) * 2 + field_data_size;
|
pExtra_data += sizeof(mz_uint16) * 2 + field_data_size;
|
||||||
extra_size_remaining = extra_size_remaining - sizeof(mz_uint16) * 2 - field_data_size;
|
extra_size_remaining = extra_size_remaining - sizeof(mz_uint16) * 2 - field_data_size;
|
||||||
} while (extra_size_remaining);
|
} while (extra_size_remaining);
|
||||||
|
// Read zip64 extended information field into comp_size, decomp_size, local_header_ofs
|
||||||
|
// Header ID: 0x0001, field size: 2 bytes
|
||||||
|
extra_size_remaining -= sizeof(mz_uint16) * 2;
|
||||||
|
pExtra_data += sizeof(mz_uint16) * 2;
|
||||||
|
if (decomp_size == MZ_UINT32_MAX && extra_size_remaining >= sizeof(mz_uint64)) {
|
||||||
|
decomp_size = MZ_READ_LE64(pExtra_data);
|
||||||
|
extra_size_remaining -= sizeof(mz_uint64);
|
||||||
|
pExtra_data += sizeof(mz_uint64);
|
||||||
|
}
|
||||||
|
if (comp_size == MZ_UINT32_MAX && extra_size_remaining >= sizeof(mz_uint64)) {
|
||||||
|
comp_size = MZ_READ_LE64(pExtra_data);
|
||||||
|
extra_size_remaining -= sizeof(mz_uint64);
|
||||||
|
pExtra_data += sizeof(mz_uint64);
|
||||||
|
}
|
||||||
|
if (local_header_ofs == MZ_UINT32_MAX && extra_size_remaining >= sizeof(mz_uint64)) {
|
||||||
|
local_header_ofs = MZ_READ_LE64(pExtra_data);
|
||||||
|
extra_size_remaining -= sizeof(mz_uint64);
|
||||||
|
pExtra_data += sizeof(mz_uint64);
|
||||||
|
}
|
||||||
MZ_FREE(buf);
|
MZ_FREE(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -934,7 +951,7 @@ static int mz_stat64(const char *path, struct __stat64 *buffer)
|
|||||||
|
|
||||||
if (comp_size != MZ_UINT32_MAX)
|
if (comp_size != MZ_UINT32_MAX)
|
||||||
{
|
{
|
||||||
if (((mz_uint64)MZ_READ_LE32(p + MZ_ZIP_CDH_LOCAL_HEADER_OFS) + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + comp_size) > pZip->m_archive_size)
|
if ((local_header_ofs + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + comp_size) > pZip->m_archive_size)
|
||||||
return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);
|
return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user