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

Bug: Unable to Find ZIP Signature in Large ZIP Files #69870

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Alanthur
Copy link

I am encountering an issue when attempting to read large ZIP files using the Go archive/zip package. The current implementation of the readDirectoryEnd function only searches for the ZIP directory end signature (0x050605) in the last 1KB and 65KB of the file. This approach does not account for cases where the ZIP file might have a larger directory section, especially in ZIP64 files.

Steps to Reproduce:

Create a large ZIP file (greater than 65KB) that contains several entries.
Attempt to read the ZIP file using the archive/zip package.
Observe that the signature for the ZIP directory end cannot be found, resulting in an error indicating that it is not a valid ZIP file.
Expected Behavior:

The readDirectoryEnd function should effectively search for the ZIP directory end signature across a larger range of the file, especially for ZIP64 files, which can have directory entries that exceed the current search limits.

Proposed Solution:

I suggest modifying the readDirectoryEnd function to increase the search range for the directory end signature. For example, consider searching within the last 5M of the file or implementing a more comprehensive search strategy that can handle ZIP64 files more effectively.
Thank you for your attention to this matter. I hope this issue can be addressed in a future release.

fix read the big zip error
Copy link

google-cla bot commented Oct 14, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant