fix: accept EOCD central-directory offsets above 16MB in zip - #180
Merged
Conversation
Collaborator
Author
|
@ james-francis-advanced fyi |
ZIP based formats could fail validation for otherwise valid files when the EOCD "start of central directory offset" exceeded 0x00FFFFFF (~16MB). The previous EOCD tail check in Zip.EndsWith hardcoded 0x00 at byte 19 (MSB of the 4byte offset field), causing false negatives for large files. Update the EOCD end pattern to treat the full offset bytes as variable (wildcards) instead of forcing a fixed MSB. Impact: - Fixes false negatives for large ZIP containers and ZIP-based formats such as XLSX, DOCX, PPTX, ODS, ODT, and ODP. Tests: - Add regression test for ZIP with EOCD central directory offset > 16MB. - Add regression test for XLSX with EOCD central directory offset > 16MB. issues #178
kryptobi
force-pushed
the
fix/long-zip-files
branch
from
July 30, 2026 14:07
75a0dca to
866c39c
Compare
TeQ2102
approved these changes
Jul 31, 2026
maxbreuker
approved these changes
Jul 31, 2026
Contributor
|
@kryptobi Verified manually against this branch with two real files whose EOCD central-directory offset is above 16 MiB:
Both are detected correctly now. Console output below 👍
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

ZIP based formats could fail validation for otherwise valid files when the EOCD "start of central directory offset" exceeded 0x00FFFFFF (~16MB). The previous EOCD tail check in Zip.EndsWith hardcoded 0x00 at byte 19 (MSB of the 4byte offset field), causing false negatives for large files.
Update the EOCD end pattern to treat the full offset bytes as variable (wildcards) instead of forcing a fixed MSB.
Impact:
Tests:
issues #178