Commit Graph

2609 Commits

Author SHA1 Message Date
Puk06
d99b406e09 fix: change default reader options in OpenArchive method for FileInfo 2026-04-21 17:02:30 +09:00
ぷこるふ
a351b56737 Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-04-21 10:26:31 +09:00
ぷこるふ
6a7e0b2f10 Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-04-21 10:09:10 +09:00
ぷこるふ
f5e27faefc Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-04-21 09:48:34 +09:00
ぷこるふ
1bd7bf2169 Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-04-21 09:40:13 +09:00
ぷこるふ
8d193db721 Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-04-21 09:32:27 +09:00
Puk06
ea950457f5 fix(docs): clarify stream handling rules and ownership in AGENTS.md 2026-04-21 09:16:16 +09:00
Puk06
23840b7a0f fix(zip): stop overriding LeaveStreamOpen in OpenArchive 2026-04-21 09:15:56 +09:00
Puk06
37c0f5aec5 fix: Change LeaveStreamOpen default from true to false
As of v0.21, the library is documented to close wrapped streams by default.
However, the ReaderOptions.LeaveStreamOpen property defaulted to true, which
contradicted the documented behavior and caused file locks when deleting
archives after extraction.

Changes:
- Set LeaveStreamOpen = false as the default (consistent with v0.21 design)
- Updated ReaderOptions.cs with comprehensive documentation explaining:
  * File-based vs caller-provided stream handling
  * When to use LeaveStreamOpen = true
  * Usage examples for both scenarios
- Updated AGENTS.md Stream Handling Rules section with:
  * Clear explanation of default disposal behavior
  * Overload differences (file-based vs stream-based)
  * Guidance on using ForExternalStream preset

This ensures the implementation matches the documented behavior and prevents
unexpected file locking issues during archive deletion.

Fixes: File deletion failures after archive extraction
2026-04-20 22:32:36 +09:00
Copilot
da30b5c805 Fix incorrect code examples in docs for sync/async usage (#1280) 2026-04-10 17:47:33 +01:00
Adam Hathcock
b2b036a2be Merge pull request #1279 from aromaa/fix/access-time-exception 2026-04-10 17:38:48 +01:00
Dirk Lemstra
ef67c0c3bd Corrected async examples. (#1277) 2026-04-10 17:34:51 +01:00
aromaa
4d774c6a7a Fix setting invalid access time fails extraction 2026-04-10 15:56:48 +03:00
Adam Hathcock
ea6946c48d Merge pull request #1266 from coderb/master
Fix three BLAKE2sp correctness bugs and eliminate allocations in hot path
2026-03-28 10:03:58 +00:00
Adam Hathcock
512f101d26 Merge remote-tracking branch 'origin/master' into coderb/master 2026-03-28 09:57:33 +00:00
Adam Hathcock
fefeed0601 Merge pull request #1267 from adamhathcock/release
Release to master
2026-03-28 09:53:45 +00:00
root
265d99095b Fix three BLAKE2sp correctness bugs and eliminate allocations in hot path
1. Fix off-by-one in Update(BLAKE2SP): pos was masked with 448 (64×7)
   instead of 511 (64×8−1), causing incorrect leaf assignment when update
   chunks are not multiples of 64 bytes. This produced wrong hashes
   whenever streaming reads didn't align to 64-byte boundaries.

2. Fix double-finalization when Read() is called again after returning 0.
   Final() was called unconditionally on each EOF read, re-running
   compression on an already-finalized state and corrupting the hash.
   EnsureHash() guards with a null-check and is idempotent; both sync
   and async Read paths share the fix. _blake2sp is set to null after
   finalization so any erroneous post-final calls fail fast rather than
   silently corrupting state.

3. Fix false-positive CRC check when stream is not fully drained.
   _hash was initialized to fileHeader.FileCrc in the constructor, so
   GetCrc() returned the expected CRC rather than the computed one if
   the stream was abandoned early. The check would then compare the
   expected hash against itself and always succeed, silently accepting
   a corrupt or incomplete file. _hash is now null until the stream is
   fully read; GetCrc() throws if called early rather than returning a
   misleading value.

Additional changes:
- Compress: stackalloc m/v arrays instead of heap; LE fast path via
  MemoryMarshal.Cast replaces 16 BitConverter.ToUInt32 calls per block
- Final(BLAKE2S): write directly to Span<byte>, eliminating MemoryStream
  and BitConverter.GetBytes allocations; 8 leaf digests now stackalloc'd
- Inner classes and fields: private, sealed, readonly where applicable
2026-03-27 13:34:00 -04:00
Adam Hathcock
7178a9e599 Merge pull request #1260 from adamhathcock/copilot/fix-multiple-decompressor-crash
Fix denial-of-service crashes in 8 decompressors on malformed input
0.47.3
2026-03-23 12:15:32 +00:00
Adam Hathcock
a3a7098ed2 Fix MalformedInputTests.cs so that it's not running in legacy 2026-03-23 11:54:17 +00:00
copilot-swe-agent[bot]
243bf00308 Address code review: fix HbCreateDecodeTables off-by-one, rename test helper
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Agent-Logs-Url: https://github.com/adamhathcock/sharpcompress/sessions/3037a2f7-f243-4261-802f-e8c83b4d6722
2026-03-23 10:03:14 +00:00
copilot-swe-agent[bot]
f038652d3b Fix multiple decompressor crashes on malformed input (IOOB, DivByZero, NullRef)
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Agent-Logs-Url: https://github.com/adamhathcock/sharpcompress/sessions/3037a2f7-f243-4261-802f-e8c83b4d6722
2026-03-23 09:55:55 +00:00
copilot-swe-agent[bot]
f608957c7a Initial plan: fix multiple decompressor crashes on malformed input
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Agent-Logs-Url: https://github.com/adamhathcock/sharpcompress/sessions/3037a2f7-f243-4261-802f-e8c83b4d6722
2026-03-23 09:37:58 +00:00
copilot-swe-agent[bot]
4540c58e98 Initial plan 2026-03-23 09:23:19 +00:00
Adam Hathcock
d7f9d25b74 Merge pull request #1257 from adamhathcock/copilot/fix-rewind-buffer-size-zstandard 0.47.2 2026-03-17 18:38:56 +00:00
copilot-swe-agent[bot]
d56b676ee9 fix: increase RewindableBufferSize to 160KB to cover ZStandard worst-case first block
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
2026-03-17 12:25:29 +00:00
Adam Hathcock
1bfc11adfa Merge pull request #1253 from adamhathcock/adam/fix-zip645-and-zipzstd
Fix ZIP64 stream bounding and WinZip AES read-state corruption in ZIP reader
0.47.1
2026-03-17 12:21:57 +00:00
copilot-swe-agent[bot]
4d6478454d Initial plan 2026-03-17 12:19:54 +00:00
Adam Hathcock
9611c4c3de try ignoring the warning that only seems to happen on GA 2026-03-17 12:12:44 +00:00
Daniel Sabel
642371f87e fixes .net 4.8 build for WinzipAesCryptoStream tests 2026-03-16 08:04:06 +01:00
Adam Hathcock
63e83dff5d Update tests/SharpCompress.Test/Zip/ZipFilePartTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-11 11:53:10 +00:00
Daniel Sabel
5fc0d691cf fixes xor range on async WinzipAesCryptoStream path 2026-03-11 08:57:47 +01:00
Adam Hathcock
b54c42028c Merge pull request #1243 from adamhathcock/adam/api-clean-up
Some API clean up from GPT 5.4
2026-03-10 16:45:29 +00:00
Daniel Sabel
03aef9e4c1 update test to reflect smaller test zip 2026-03-09 14:04:17 +01:00
Daniel Sabel
51859f9a2b fixes decompression of large mixed encrypted zip files 2026-03-09 14:02:31 +01:00
Adam Hathcock
b05a16d007 oops, wrong change made 2026-03-06 15:39:07 +00:00
Adam Hathcock
e6a179bdb5 fmt 2026-03-06 15:33:57 +00:00
Adam Hathcock
f13ab3a0e7 FindFactoryAsync shouldn't be public 2026-03-06 15:33:30 +00:00
Adam Hathcock
ebd784cfb2 code review changes 2026-03-06 15:16:28 +00:00
Adam Hathcock
15d6d3c641 Merge remote-tracking branch 'origin/master' into adam/api-clean-up 2026-03-06 15:12:56 +00:00
Adam Hathcock
542f71f0de Merge pull request #1244 from adamhathcock/copilot/sub-pr-1243
Rename IWriteableArchiveFactory.cs to IWritableArchiveFactory.cs
2026-03-06 15:07:36 +00:00
Adam Hathcock
c6e2221b24 Merge pull request #1245 from adamhathcock/adam/clean-up-tests
Proper test file clean up
2026-03-06 15:07:08 +00:00
Adam Hathcock
04d1a10114 don't use static scratch directory for tests. Throw exception when test can't clean up 2026-03-06 14:58:04 +00:00
copilot-swe-agent[bot]
b0e9736005 Rename IWriteableArchiveFactory.cs to IWritableArchiveFactory.cs to match interface name
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
2026-03-06 14:52:06 +00:00
copilot-swe-agent[bot]
bf32c85933 Initial plan 2026-03-06 14:48:55 +00:00
Adam Hathcock
9050a7a64a remove extra creates 2026-03-06 11:43:44 +00:00
Adam Hathcock
f34ed8bd94 first commit for conslidating publci api 2026-03-06 11:22:09 +00:00
Adam Hathcock
b719edfa57 Merge pull request #1242 from adamhathcock/adam/update-deps
Update test dependencies
0.47.0
2026-03-03 17:29:30 +00:00
Adam Hathcock
7c0e3d584a Update test dependencies 2026-03-03 17:01:21 +00:00
Adam Hathcock
5a8119e562 Merge remote-tracking branch 'origin/release'
# Conflicts:
#	src/SharpCompress/Common/Zip/ZipFilePart.cs
#	src/SharpCompress/IO/SharpCompressStream.cs
2026-03-03 16:25:10 +00:00
Adam Hathcock
1d07f4e1ca Merge pull request #1237 from adamhathcock/copilot/fix-zip-extraction-error
Fix DataErrorException when extracting LZMA-compressed zero-byte ZIP entries
2026-03-03 16:21:11 +00:00