Commit Graph

3189 Commits

Author SHA1 Message Date
Adam Hathcock
2f040283fc Preserve legacy 7z property size compatibility during preflight 2026-11-13 09:36:55 +00:00
Adam Hathcock
101c939cc6 Exclude trusted LZMA2 writer trials from LZMA input limits 2026-11-13 09:35:09 +00:00
Adam Hathcock
7f7b8c7eda Validate effective TAR PAX sizes before streaming 2026-11-13 09:33:35 +00:00
Adam Hathcock
b10627339c Normalize TAR duplicate keys consistently with the writer 2026-11-13 09:32:21 +00:00
Adam Hathcock
85bf5141e6 Reject unsupported Zstandard window limits at assignment 2026-11-13 09:31:43 +00:00
Adam Hathcock
f2e4df509b Keep LZMA decoders retryable after dictionary limit rejection 2026-11-13 09:28:53 +00:00
Adam Hathcock
09b95f1841 Fix PPMd properties state after rejected allocator changes 2026-11-13 09:27:51 +00:00
Adam Hathcock
b76c336658 Merge remote-tracking branch 'origin/release' into adam/merge-release-into-master
# Conflicts:
#	.github/workflows/nuget-release.yml
#	src/SharpCompress/Common/SevenZip/ArchiveReader.Async.cs
#	src/SharpCompress/Common/SevenZip/ArchiveReader.cs
2026-11-12 16:52:39 +00:00
Adam Hathcock
760eef37ab Merge commit from fork
Fix GHSA-xmfm-xg76-qx62: bound decompression dictionary allocations
0.50.9
2026-11-12 15:09:10 +00:00
Adam Hathcock
e9a6045c88 Merge commit from fork
Prevent excessive allocations from forged 7z header fields
2026-11-12 15:07:57 +00:00
Adam Hathcock
1ba0eaa629 Merge commit from fork
Reject negative TAR entry sizes and overflowing seek offsets
2026-11-12 15:07:09 +00:00
Adam Hathcock
24a13d3c38 Merge commit from fork
Fix BZip2 streaming decoder hang on corrupted input
2026-11-12 15:06:00 +00:00
Adam Hathcock
cecd8543a4 Bound decompression dictionaries with static size limits 2026-11-09 13:23:53 +00:00
Adam Hathcock
8ec2188ee0 Validate 7z header counts before allocation
Bound nested metadata counts and coder properties by their backing data, validate file and stream consistency, and buffer decoded headers incrementally instead of reserving attacker-declared output sizes.

Add synchronous and asynchronous allocation regressions for GHSA-vwpg-q8vc-g6fg, including external metadata and valid bit-packed empty entries.
2026-11-09 11:53:34 +00:00
Adam Hathcock
30586fdcc5 Validate full-width TAR binary sizes
Combine the decoder and padding size bounds from advisory PR #1 with the checked seek offsets and sync/async regression coverage in PR #2.

Co-authored-by: 4nonym0us <2701409+4nonym0us@users.noreply.github.com>
2026-11-09 11:34:11 +00:00
Adam Hathcock
46ba719daa Reject negative TAR entry sizes and overflowing seek offsets 2026-11-09 11:28:55 +00:00
Adam Hathcock
839dcb1ffb Merge pull request #1490 from adamhathcock/fix/legacy-startswith-char
Fix netstandard2.0/net48 build in writable archive key normalisation
2026-11-09 11:26:03 +00:00
Adam Hathcock
b85ccd28d8 Fix netstandard2.0/net48 build in writable archive key normalisation
string.StartsWith(char) is not available on netstandard2.0 or net48,
so those targets failed to compile after 990186ac.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 11:20:50 +00:00
Adam Hathcock
fa3dff056a Reject stalled BZip2 decoder states after corruption 2026-11-09 11:16:14 +00:00
Adam Hathcock
54432058de Merge commit from fork
Fix writable archive duplicate entry checks
2026-11-07 09:56:57 +00:00
Adam Hathcock
990186acc5 Fix writable archive duplicate entry checks 2026-11-06 16:03:00 +00:00
Adam Hathcock
dfccc660db Merge pull request #1489 from adamhathcock/fix/build-and-tests
Update .NET SDK to fix AOT restore
2026-11-06 09:53:08 +00:00
Adam Hathcock
82cc8c98c4 Update .NET SDK to address AOT restore vulnerability 2026-11-06 09:24:18 +00:00
Adam Hathcock
ba6d1d369c Merge commit from fork
Reject Deflate back-references beyond initialized history
2026-11-06 09:09:38 +00:00
Adam Hathcock
9a04b51c0b Reject Deflate back-references beyond initialized history 2026-11-04 17:03:41 +00:00
Adam Hathcock
ef3a923211 use ODIC nuget workflow 0.50.8 2026-11-03 09:50:32 +00:00
Adam Hathcock
da5ac7528f Merge pull request #1488 from adamhathcock/fix/1485-solid-7z-deflate
Fix solid 7z Deflate extraction corruption
2026-11-03 09:25:49 +00:00
Adam Hathcock
d5014d3a1c fix legacy test 2026-11-02 16:11:45 +00:00
Adam Hathcock
688f1f7036 Fix solid 7z Deflate entry extraction 2026-11-02 13:27:58 +00:00
Adam Hathcock
6128ec51ee Merge pull request #1484 from adamhathcock/chore/update-nuget-and-sdk
Update NuGet packages and .NET SDK
2026-10-31 10:35:09 +00:00
Adam Hathcock
872274d2f8 Update NuGet packages and .NET SDK 2026-10-31 10:10:40 +00:00
Adam Hathcock
e8f894c9a0 Merge pull request #1483 from drone1400/fix/tar-ustar-long-name-split-windows
Fix TAR USTAR long name split on Windows
2026-10-31 09:58:17 +00:00
drone1400
1aa9238884 Fix USTAR long name split on Windows
TarHeader searched for the split point between the prefix and name
fields using Path.DirectorySeparatorChar, but TarWriter has already
normalized the name to use '/'. On Windows Path.DirectorySeparatorChar
is '\', so no separator was ever found and every name longer than 100
bytes threw InvalidFormatException ("Directory separator not found!"),
even though it could be stored using the prefix field. Linux and macOS
were not affected.

Search for '/' instead, in both WriteUstar and WriteUstarAsync. The
tests added in the previous commit now pass on Windows too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 11:48:10 +02:00
drone1400
fb0cd47bb0 Add tests for long USTAR names split at a directory separator
When an entry name is longer than the 100 byte USTAR name field,
TarHeader splits it into the 155 byte prefix field and the name field
at a directory separator. The existing tests only covered short paths
and long names without any separator.

Add sync and async tests that write a 186 byte path (with '/' and
'\' separators as input) using the USTAR format and read it back.

On Windows these tests fail with InvalidFormatException ("Directory
separator not found!"), which the next commit fixes. They pass on
Linux and macOS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 11:48:10 +02:00
Adam Hathcock
dedbf6ac57 Merge pull request #1481 from adamhathcock/adam/lzma2-invalid-props
Report invalid LZMA2 chunk properties as a data error
2026-10-27 15:32:27 +00:00
Adam Hathcock
c4028139fd Report invalid LZMA2 chunk properties as a data error
An LZMA2 chunk header properties byte of 225 or more cannot occur in
valid data, but it reached Decoder.SetDecoderProperties and surfaced as
InvalidParamException. EncryptedDecoderStream only maps DataErrorException
to CryptographicException, so a wrong 7z password occasionally leaked the
internal codec exception, making
SevenZipWriter_Encrypted_WrongPasswordFails flaky.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 15:02:07 +00:00
Adam Hathcock
51c00c62d8 Merge pull request #1480 from wleeaf/empty-compressed-streams
Write a valid compressed stream when no data is written
2026-10-27 13:48:40 +00:00
Adam Hathcock
c6712678d6 Merge pull request #1479 from wleeaf/zip-utf8-name-flag
Set the UTF-8 flag for zip entry names encoded as UTF-8 without a BOM
2026-10-27 13:47:53 +00:00
Wleeaf
aa54f11acc Write a valid compressed stream when no data is written 2026-10-26 20:47:22 +00:00
Wleeaf
ea2986708f Set the UTF-8 flag for zip entry names encoded as UTF-8 without a BOM 2026-10-26 16:48:33 +00:00
Adam Hathcock
b2fade6400 allow pre-release tags 0.51.0-beta2 2026-10-26 16:47:21 +00:00
Adam Hathcock
deaabb5504 Merge pull request #1469 from adamhathcock/dependabot/nuget/build/all-dependencies-232486072c
Bump the all-dependencies group with 5 updates
0.51.0-beta1
2026-10-26 16:35:15 +00:00
Adam Hathcock
f34ac19f22 Merge pull request #1478 from adamhathcock/perf/sevenzip-allocation-fixes
Reduce allocations in 7z encryption and codec lookup
2026-10-26 14:24:50 +00:00
Adam Hathcock
dd6d09c6d2 Reduce allocations in 7z encryption and codec lookup 2026-10-26 13:45:21 +00:00
Adam Hathcock
fa96277b96 Merge pull request #1476 from jaysanati/feature/7z-write-encryption-master
SevenZipWriter: password protection (7zAES) and encrypted headers
2026-10-26 13:17:32 +00:00
Adam Hathcock
2fa1dec513 Merge pull request #1473 from adamhathcock/review/fix-zip64-descriptor-width
Fix ZIP64 streaming data descriptor width parsing
2026-10-26 11:36:16 +00:00
Adam Hathcock
8fa17607d8 Merge pull request #1477 from adamhathcock/perf/xz-async-decoding
Optimize XZ async reads and buffered LZMA2 decoding
2026-10-26 08:27:00 +00:00
Adam Hathcock
0a716d4236 Merge pull request #1475 from jaysanati/fix/7z-encrypted-compression-type
Report the codec, not 7zAES, as an encrypted 7z entry's CompressionType
2026-10-26 08:24:34 +00:00
Adam Hathcock
0c6b575135 Merge remote-tracking branch 'origin/master' into perf/xz-async-decoding 2026-10-26 08:01:44 +00:00
Adam Hathcock
4a07d63f13 Merge pull request #1474 from adamhathcock/fix/xz-bcj-streaming
Fix streaming XZ BCJ decoding and release pooled filter buffers
2026-10-26 08:00:24 +00:00