[PR #852] [MERGED] Fixed extractions after first ZIP64 entry is read from stream #1282

Closed
opened 2026-01-29 22:19:47 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/adamhathcock/sharpcompress/pull/852
Author: @pathartl
Created: 6/22/2024
Status: Merged
Merged: 6/26/2024
Merged by: @adamhathcock

Base: masterHead: fix-post-zip64-entry-subsequent-extractions


📝 Commits (4)

  • b7b78ed Fixed extractions after first ZIP64 entry is read from stream
  • eee518b Reworked ZIP64 handling to separate block
  • 9bc0a1d Null reference checking
  • b89de6c Fix formatting

📊 Changes

2 files changed (+59 additions, -6 deletions)

View changed files

📝 src/SharpCompress/Common/Zip/StreamingZipHeaderFactory.cs (+57 -4)
📝 src/SharpCompress/Common/Zip/ZipHeaderFactory.cs (+2 -2)

📄 Description

When a ZIP64 entry is extracted from an archive, the header for the next entry is read out of order. This commit reads the header again, then resets the position of the RewindableStream back to the beginning of the entry, just after the 4 byte header signature. This ensures the correct header signature data and reader (in the correct position) are fed to ReadHeader. Previously this would have read the data at an incorrect offset and would not yield a viable ZipHeader.

I haven't done extensive testing with this nor did I write any automated tests.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/adamhathcock/sharpcompress/pull/852 **Author:** [@pathartl](https://github.com/pathartl) **Created:** 6/22/2024 **Status:** ✅ Merged **Merged:** 6/26/2024 **Merged by:** [@adamhathcock](https://github.com/adamhathcock) **Base:** `master` ← **Head:** `fix-post-zip64-entry-subsequent-extractions` --- ### 📝 Commits (4) - [`b7b78ed`](https://github.com/adamhathcock/sharpcompress/commit/b7b78edaa311ad25409092d1168e25f4a99799d1) Fixed extractions after first ZIP64 entry is read from stream - [`eee518b`](https://github.com/adamhathcock/sharpcompress/commit/eee518b7fad11f04b1bc8c0938f27e622ae7b14d) Reworked ZIP64 handling to separate block - [`9bc0a1d`](https://github.com/adamhathcock/sharpcompress/commit/9bc0a1d7c7fac9457abc6721a672dbc82bced811) Null reference checking - [`b89de6c`](https://github.com/adamhathcock/sharpcompress/commit/b89de6caadc4c044737a7bc1ec5239729c15e899) Fix formatting ### 📊 Changes **2 files changed** (+59 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `src/SharpCompress/Common/Zip/StreamingZipHeaderFactory.cs` (+57 -4) 📝 `src/SharpCompress/Common/Zip/ZipHeaderFactory.cs` (+2 -2) </details> ### 📄 Description When a ZIP64 entry is extracted from an archive, the header for the next entry is read out of order. This commit reads the header again, then resets the position of the RewindableStream back to the beginning of the entry, just after the 4 byte header signature. This ensures the correct header signature data and reader (in the correct position) are fed to ReadHeader. Previously this would have read the data at an incorrect offset and would not yield a viable ZipHeader. I haven't done extensive testing with this nor did I write any automated tests. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 22:19:47 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#1282