mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-12 21:22:26 +00:00
[PR #1015] [CLOSED] Fix EndOfFileException crash in ZStandardStream.IsZStandard when reading streams with insufficient bytes #1437
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/adamhathcock/sharpcompress/pull/1015
Author: @Copilot
Created: 11/12/2025
Status: ❌ Closed
Base:
master← Head:copilot/fix-tararchive-open-crash📝 Commits (2)
3ba27ebInitial planc586556Fix ZStandardStream.IsZStandard to handle streams with insufficient bytes📊 Changes
2 files changed (+44 additions, -1 deletions)
View changed files
📝
src/SharpCompress/Compressors/ZStandard/ZStandardStream.cs(+6 -1)📝
tests/SharpCompress.Test/Tar/TarArchiveTests.cs(+38 -0)📄 Description
TarArchive.Open()crashes withEndOfFileExceptionwhen processing TAR files or small streams. The crash occurs inZStandardStream.IsZStandard()which attempts to read a UInt32 (4 bytes) without checking stream size.Changes
BinaryReader.ReadUInt32()withReadBytes(4)and length validation before converting to UInt32, matching the pattern used by other compression format checks (BZip2Stream.IsBZip2(),GZipArchive.IsGZipFile())Before
After
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.