[PR #528] [MERGED] Ensure TarArchive enumerates all entries #1076

Open
opened 2026-01-29 22:18:54 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/adamhathcock/sharpcompress/pull/528
Author: @DannyBoyk
Created: 7/20/2020
Status: Merged
Merged: 7/26/2020
Merged by: @adamhathcock

Base: masterHead: issue_524_tararchive_fails_read_all_entries


📝 Commits (1)

  • d055b34 Ensure TarArchive enumerates all entries

📊 Changes

3 files changed (+53 additions, -11 deletions)

View changed files

📝 src/SharpCompress/Common/Tar/TarFilePart.cs (+1 -1)
📝 src/SharpCompress/Common/Tar/TarReadOnlySubStream.cs (+12 -10)
📝 tests/SharpCompress.Test/Tar/TarArchiveTests.cs (+40 -0)

📄 Description

While enumerating the entries of a tar file and writing their contents
to disk using TarArchive, it was discovered TarArchive was not properly
discarding padding bytes in the last block of each entry. TarArchive was
sometimes able to recover depending on the number of padding bytes due
to the logic it uses to find the next entry header, but not always.

TarArchive was changed to use TarReadOnlySubStream when opening entries
and TarReadOnlySubstream was changed to ensure all an entry's blocks are
read when it is being disposed.

Fixes adamhathcock/sharpcompress#524


🔄 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/528 **Author:** [@DannyBoyk](https://github.com/DannyBoyk) **Created:** 7/20/2020 **Status:** ✅ Merged **Merged:** 7/26/2020 **Merged by:** [@adamhathcock](https://github.com/adamhathcock) **Base:** `master` ← **Head:** `issue_524_tararchive_fails_read_all_entries` --- ### 📝 Commits (1) - [`d055b34`](https://github.com/adamhathcock/sharpcompress/commit/d055b34efec7aafcf95a97ec2b4d671826469464) Ensure TarArchive enumerates all entries ### 📊 Changes **3 files changed** (+53 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `src/SharpCompress/Common/Tar/TarFilePart.cs` (+1 -1) 📝 `src/SharpCompress/Common/Tar/TarReadOnlySubStream.cs` (+12 -10) 📝 `tests/SharpCompress.Test/Tar/TarArchiveTests.cs` (+40 -0) </details> ### 📄 Description While enumerating the entries of a tar file and writing their contents to disk using TarArchive, it was discovered TarArchive was not properly discarding padding bytes in the last block of each entry. TarArchive was sometimes able to recover depending on the number of padding bytes due to the logic it uses to find the next entry header, but not always. TarArchive was changed to use TarReadOnlySubStream when opening entries and TarReadOnlySubstream was changed to ensure all an entry's blocks are read when it is being disposed. Fixes adamhathcock/sharpcompress#524 --- <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:18:54 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#1076