mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
[PR #1015] Fix EndOfFileException crash in ZStandardStream.IsZStandard when reading streams with insufficient bytes #1440
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?
Original Pull Request: https://github.com/adamhathcock/sharpcompress/pull/1015
State: closed
Merged: No
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.