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

minizip: Fix ZIPReader failing to open empty zip files #73310

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

RedworkDE
Copy link
Member

Fixes #73271

The problem is that minizip uses the offset 0 to mark the failure to find the central directory of the zip file, but if the zip file is empty the central directory is the only thing left in the file, so actually is located at offset 0.

This makes it use 0xffffffffffffffff (max value of an unsigned 64bit integer like ZPOS64_T) instead, which truly cannot be a valid as if the 20 byte structure were to start there it would immediately overflow the offset variable. (Also thats a 16EB file, what are you storing?)

@RedworkDE RedworkDE requested a review from a team as a code owner February 14, 2023 22:00
@Faless
Copy link
Collaborator

Faless commented Feb 15, 2023

Is this a fix for the upstream madler/zlib#199 ?
If so, it should probably be proposed there too.

@RedworkDE
Copy link
Member Author

Upstream PR: madler/zlib#778

@akien-mga akien-mga modified the milestones: 4.1, 4.2 Jun 19, 2023
@YuriSizov YuriSizov merged commit 2c8d61c into godotengine:master Jul 12, 2023
@RedworkDE RedworkDE deleted the zip-empty branch July 12, 2023 15:26
@YuriSizov
Copy link
Contributor

Thanks!

akien-mga added a commit to akien-mga/godot that referenced this pull request Aug 29, 2023
Upstreams the fix from godotengine#73310, so we can remove that patch.
Remove `infback.c` which we stopped compiling after godotengine#79273.

The `OF` macro was also removed so I can drop the patch where I yell
at Gentoo developers.
mandryskowski pushed a commit to mandryskowski/godot that referenced this pull request Oct 11, 2023
Upstreams the fix from godotengine#73310, so we can remove that patch.
Remove `infback.c` which we stopped compiling after godotengine#79273.

The `OF` macro was also removed so I can drop the patch where I yell
at Gentoo developers.
@YuriSizov YuriSizov added the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Oct 24, 2023
@YuriSizov
Copy link
Contributor

Cherry-picked for 4.1.3 (not needed, technically, but makes cherry-picking #81111 much easier).

@YuriSizov YuriSizov removed the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Oct 24, 2023
YuriSizov pushed a commit to YuriSizov/godot that referenced this pull request Oct 24, 2023
Upstreams the fix from godotengine#73310, so we can remove that patch.
Remove `infback.c` which we stopped compiling after godotengine#79273.

The `OF` macro was also removed so I can drop the patch where I yell
at Gentoo developers.

(cherry picked from commit e0e1f2e)
@akien-mga akien-mga changed the title Fix ZIPReader failing to open empty zip files minizip: Fix ZIPReader failing to open empty zip files Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ZIPReader cannot open empty zip file
4 participants