Repository navigation
Use the actual length of data descriptors when removing entries - #433
Merged
weichsel merged 2 commits intoNov 18, 2026
Merged
Conversation
weichsel
force-pushed
the
fix/data-descriptor-length
branch
from
November 18, 2026 16:56
b9d45ca to
7c4c318
Compare
`Entry.localSize` always added the size of a descriptor with a signature, but descriptors without one are 4 bytes shorter. A ZIP64 entry whose descriptor matched neither layout was always treated as having 8 byte sizes. It now has 8 byte sizes only if its local file header has ZIP64 extended information. In both cases, `Archive.remove` copied bytes of the following entry into the rewritten archive.
weichsel
force-pushed
the
fix/data-descriptor-length
branch
from
November 18, 2026 17:04
7c4c318 to
e00709a
Compare
The local file header of the entry has ZIP64 extended information, so the descriptor with 8 byte sizes is kept although neither layout matches.
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.
Entry.localSizenow uses the length of the data descriptor as it is stored in the archive:Before,
Archive.removecopied the first bytes of the following entry into the rewritten archive, andtotalUnitCountForRemovingwas off by the same amount.Fixes #435. Stacked on #432.