Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore number_entry_cd #827

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compat/unzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion mz_zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Binary file not shown.
Loading