124 Commits

Author SHA1 Message Date
Adam Hathcock
f63cd81a65 Reduce allocations in encrypted RAR reading
Reuse bounded buffers and transform AES blocks in place. Remove per-block arrays and plaintext queues, avoid per-byte header allocations, and dispose owned crypto transforms.

Add encrypted RAR benchmarks, regression tests, and before/after profiling results. Full .NET 10 suite passes (2,446 tests); all library targets build and net48 tests compile.
2026-10-20 10:43:28 +01:00
Adam Hathcock
e61a335d54 Reduce allocations in RAR5 password key derivation
Reuse keyed HMAC state and digest buffers on modern .NET targets while preserving RAR5's three PBKDF2 snapshots. Add independent derivation checks and an allocation regression test.

Profiling on macOS ARM64 with .NET 10 reduced allocations by 99.96%, but showed slower throughput; Alpine-specific timing remains unverified. Full .NET 10 test suite passes.
2026-10-20 10:10:29 +01:00
Adam Hathcock
eac609b35a Report truncated encrypted RAR data as InvalidFormatException asynchronously
ReadExactAsync throws IncompleteArchiveException, so the async decrypt
path's EndOfStreamException catch never ran. On net48, EntryStream.Dispose
skips the entry through the async path, so its IncompleteArchiveException
replaced the InvalidFormatException from the synchronous read and failed
Rar_Multi_Reader_Encrypted. Sync and async now report truncated encrypted
data as InvalidFormatException.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 15:23:52 +01:00
Adam Hathcock
06fea02e64 Resolve RAR companion volumes with unambiguous case-insensitive fallback 2026-10-10 15:40:36 +01:00
Adam Hathcock
ab3ac18e98 Fix release review findings in RAR, GZip, and split ZIP parsing 2026-10-10 08:22:55 +01:00
Adam Hathcock
830c816269 Fix net48 test build: use plain using for types without DisposeAsync
AsyncOnlyStream and EntryStream have no DisposeAsync on net48, so
await using fails to compile for that target.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 14:41:59 +01:00
Adam Hathcock
bc58792b86 Fix encrypted RAR header state when rescanning archives
Reset scan-specific encryption state in sync and async header readers while retaining the KDF cache. Add RAR4/RAR5 rescan and solid encrypted extraction regression coverage.

Fixes #1422
2026-10-09 11:56:35 +01:00
Adam Hathcock
2071e9036a Merge pull request #1426 from adamhathcock/fix/rar5-file-data-key-cache
Reuse RAR5 derived keys across encrypted file entries
2026-10-05 11:10:18 +01:00
Adam Hathcock
2cd70d019f Reuse RAR5 derived keys across encrypted file entries 2026-10-05 11:05:33 +01:00
Adam Hathcock
ce081cda1c fix build 2026-10-05 10:59:57 +01:00
Adam Hathcock
915183320c added some review fixes 2026-10-05 10:48:34 +01:00
Adam Hathcock
4f8c69f2c3 don't use RarReader directory 2026-10-02 15:23:16 +01:00
Adam Hathcock
d3edc48654 Merge remote-tracking branch 'origin/release' into fix/rar5-encrypted-comments 2026-10-02 13:53:38 +01:00
Adam Hathcock
b67a8a4ead Fix encrypted RAR5 archive comments 2026-10-02 13:33:55 +01:00
Adam Hathcock
c90997e12e Fix repeated RAR5 encrypted header key derivation 2026-10-02 09:39:38 +01:00
Adam Hathcock
e9e05520d6 7Zip and Rar 2026-06-15 09:29:50 +01:00
Adam Hathcock
117eaa8167 Merge remote-tracking branch 'origin/master' into adam/merge-release-to-master
# Conflicts:
#	src/SharpCompress/Common/ExtractionMethods.Async.cs
#	src/SharpCompress/Common/ExtractionMethods.cs
2026-05-06 10:11:30 +01:00
Adam Hathcock
0352740ea1 more async tests 2026-04-28 09:14:31 +01:00
Adam Hathcock
fc096e1996 new tests 2026-04-28 08:48:30 +01:00
Adam Hathcock
896dfd6537 some AI changes 2026-04-28 08:32:44 +01:00
Adam Hathcock
5d14c96fb0 clean up seekable checks 2026-04-23 10:19:37 +01:00
Adam Hathcock
3ed94dd462 add seekable checks 2026-04-23 09:56:26 +01:00
copilot-swe-agent[bot]
5d75f8c36d Fix ForExternalStream→ForFilePath for file-path overloads and update SymbolicLinkHandler remarks
Agent-Logs-Url: https://github.com/adamhathcock/sharpcompress/sessions/41bf7d12-f140-47cf-96f9-3620eeb0eb32

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
2026-04-21 13:11:31 +00:00
Adam Hathcock
6a402a3b50 use with methods 2026-04-21 11:04:14 +01:00
Adam Hathcock
4f1f32b508 Fix usages of ReaderOptions 2026-04-21 10:55:59 +01:00
Adam Hathcock
f34ed8bd94 first commit for conslidating publci api 2026-03-06 11:22:09 +00:00
Adam Hathcock
eb844e8016 Fixed some exception tests 2026-02-16 16:29:20 +00:00
Adam Hathcock
855d4b4ce2 Use more SC exceptions instead of generic ones 2026-02-16 12:40:07 +00:00
Adam Hathcock
4ab03c0093 fixed more 2026-02-16 09:27:06 +00:00
Adam Hathcock
5263f43c29 more nulls and a namespace folder fix 2026-02-13 15:01:12 +00:00
Adam Hathcock
26d49198f0 Merge remote-tracking branch 'origin/master' into adam/fix-editorconfig-errors
# Conflicts:
#	src/SharpCompress/Common/Zip/ZipFilePart.cs
#	src/SharpCompress/Compressors/BZip2/BZip2Stream.cs
2026-02-13 14:23:42 +00:00
Adam Hathcock
5a319ffe2c create/open always has to be async for detection 2026-02-12 10:18:43 +00:00
Adam Hathcock
99d8eb9265 some build fixes 2026-02-11 11:04:25 +00:00
Adam Hathcock
cf0ad9b323 Merge remote-tracking branch 'origin/copilot/fix-rar-extraction-issues' into adam/cleanup-options 2026-02-09 17:30:50 +00:00
Adam Hathcock
04dd177f19 first pass of removing extraction options (folded into reader options) 2026-02-09 16:52:54 +00:00
Adam Hathcock
c4a28e7cfb Update tests/SharpCompress.Test/Rar/RarArchiveAsyncTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-09 09:11:19 +00:00
Adam Hathcock
29197f2142 Update tests/SharpCompress.Test/Rar/RarArchiveTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-09 09:10:59 +00:00
copilot-swe-agent[bot]
d5cab8172b Address code review feedback: clarify file size comment
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
2026-02-08 12:54:11 +00:00
copilot-swe-agent[bot]
4084b347d4 Fix RAR extraction to preserve subdirectory structure
- Set default ExtractFullPath=true in WriteToDirectoryInternal methods
- Add test case with sample RAR archive containing subdirectories
- Tests verify files are extracted to correct subdirectories, not root

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
2026-02-08 12:52:25 +00:00
Adam Hathcock
642b8bddb8 fixed merge 2026-02-04 14:41:55 +00:00
Adam Hathcock
27f7221902 Merge remote-tracking branch 'origin/release' into adam/release-merge
# Conflicts:
#	Directory.Packages.props
#	build/packages.lock.json
#	src/SharpCompress/Common/Zip/WinzipAesEncryptionData.cs
#	src/SharpCompress/SharpCompress.csproj
#	src/SharpCompress/packages.lock.json
#	tests/SharpCompress.Performance/packages.lock.json
#	tests/SharpCompress.Test/SharpCompress.Test.csproj
#	tests/SharpCompress.Test/packages.lock.json
2026-02-04 14:35:40 +00:00
copilot-swe-agent[bot]
ad7e64ba43 Fix test to use correct RarArchive API - all RAR tests passing
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
2026-02-02 09:33:37 +00:00
copilot-swe-agent[bot]
8737b7a38e Apply infinite loop fix to SourceStream.cs and add test case
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
2026-02-02 09:31:38 +00:00
Adam Hathcock
44174e7b03 some fixes 2026-01-20 09:07:57 +00:00
copilot-swe-agent[bot]
0de5c59a77 Restore AsyncOnlyStream in archive async tests as requested
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
2026-01-16 09:50:36 +00:00
copilot-swe-agent[bot]
c7da19f3a5 Format code with CSharpier
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
2026-01-16 09:26:04 +00:00
copilot-swe-agent[bot]
e919930cf6 Fix Archive async tests to not use AsyncOnlyStream (archives need seekable streams)
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
2026-01-16 09:23:32 +00:00
copilot-swe-agent[bot]
2906529080 Fix ReaderFactory.OpenAsyncReader to use async IsArchiveAsync methods
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
2026-01-16 09:12:54 +00:00
Adam Hathcock
ec310c87de merge fixes and fmt 2026-01-15 15:20:52 +00:00
Adam Hathcock
c55a383112 Merge remote-tracking branch 'origin/master' into adam/async-again
# Conflicts:
#	tests/SharpCompress.Test/GZip/GZipReaderAsyncTests.cs
#	tests/SharpCompress.Test/Rar/RarArchiveAsyncTests.cs
#	tests/SharpCompress.Test/SevenZip/SevenZipArchiveAsyncTests.cs
#	tests/SharpCompress.Test/Tar/TarArchiveAsyncTests.cs
#	tests/SharpCompress.Test/Tar/TarReaderAsyncTests.cs
#	tests/SharpCompress.Test/Zip/Zip64AsyncTests.cs
#	tests/SharpCompress.Test/Zip/ZipMemoryArchiveWithCrcAsyncTests.cs
2026-01-15 15:18:05 +00:00