Skip to content

Zip: fix Zip64 streaming reader corrupting entry size/CRC and failing on non-seekable streams#1362

Merged
adamhathcock merged 1 commit into
adamhathcock:masterfrom
LANCommander:fix-zip64-streaming-corrupted-entry-sizes
Jul 2, 2026
Merged

Zip: fix Zip64 streaming reader corrupting entry size/CRC and failing on non-seekable streams#1362
adamhathcock merged 1 commit into
adamhathcock:masterfrom
LANCommander:fix-zip64-streaming-corrupted-entry-sizes

Conversation

@pathartl

Copy link
Copy Markdown
Contributor

The Zip64 branch of the streaming header reader assumed a data descriptor always follows a >=4GB entry. When the entry instead has back-patched sizes (no descriptor), the following header was parsed as descriptor fields, overwriting the entry's correct size/CRC with central-directory 0xFFFFFFFF sentinels and, on non-seekable async streams, leaving the reader misaligned so the next entry threw.

Now it detects a header signature after the entry data and leaves the already-correct metadata untouched, parsing that header normally. The fix has been applied to both the sync and async readers.

… on non-seekable streams

The Zip64 branch of the streaming header reader assumed a data descriptor always follows a >=4GB entry. When the entry instead has back-patched sizes (no descriptor), the following header was parsed as descriptor fields, overwriting the entry's correct size/CRC with central-directory 0xFFFFFFFF sentinels and, on non-seekable async streams, leaving the reader misaligned so the next entry threw.

Now it detects a header signature after the entry data and leaves the already-correct metadata untouched, parsing that header normally. The fix has been applied to both the sync and async readers.
@adamhathcock

Copy link
Copy Markdown
Owner

Smells right to me. Thanks for this!

@adamhathcock
adamhathcock merged commit 35aa0ca into adamhathcock:master Jul 2, 2026
3 checks passed
This was referenced Jul 13, 2026
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.

2 participants