mirror of
https://github.com/zlib-ng/minizip-ng
synced 2026-08-25 14:26:08 -04:00
ignore number_entry_cd when recover
This commit is contained in:
parent
d7f5fdd19a
commit
6d45beb98d
3 changed files with 4 additions and 1 deletions
|
|
@ -137,6 +137,8 @@ unzFile unzOpen_MZ(void *stream) {
|
|||
if (!handle)
|
||||
return NULL;
|
||||
|
||||
mz_zip_set_recover(handle, 1);
|
||||
|
||||
err = mz_zip_open(handle, stream, MZ_OPEN_MODE_READ);
|
||||
if (err != MZ_OK) {
|
||||
mz_zip_delete(&handle);
|
||||
|
|
|
|||
3
mz_zip.c
3
mz_zip.c
|
|
@ -980,7 +980,8 @@ static int32_t mz_zip_read_cd(void *handle) {
|
|||
if (err == MZ_OK)
|
||||
err = mz_stream_read_uint16(zip->stream, &value16);
|
||||
number_entry_cd = value16;
|
||||
if (number_entry_cd != zip->number_entry)
|
||||
/* When recover is enabled, we can ignore incorrect number of entries */
|
||||
if (number_entry_cd != zip->number_entry && !zip->recover)
|
||||
err = MZ_FORMAT_ERROR;
|
||||
/* Size of the central directory */
|
||||
if (err == MZ_OK)
|
||||
|
|
|
|||
BIN
test/fuzz/unzip_fuzzer_seed_corpus/incorrect_number_entries.zip
Normal file
BIN
test/fuzz/unzip_fuzzer_seed_corpus/incorrect_number_entries.zip
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue