[PR #528] Ensure TarArchive enumerates all entries #1079

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

Original Pull Request: https://github.com/adamhathcock/sharpcompress/pull/528

State: closed
Merged: Yes


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

**Original Pull Request:** https://github.com/adamhathcock/sharpcompress/pull/528 **State:** closed **Merged:** Yes --- 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
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#1079