Changed validation condition from `_position != Length` to `_position < Length` in RarStream.Read() and RarStream.ReadImplAsync() to only throw when unpacking ends prematurely, not when more data is unpacked than the header specifies. This allows successful extraction of RAR files where the actual uncompressed size exceeds the header size.
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
The SyncOnlyStream wrapper is necessary because the LZMA decoder has bugs in its async implementation that cause state corruption (IndexOutOfRangeException, DataErrorException) even with fresh, non-shared streams.
Without this wrapper, async operations on LZMA streams fail. The proper fix would be to repair the async bugs in LzmaStream.ReadAsync, Decoder.CodeAsync, and OutWindow async operations, but that requires deep changes to the decoder state machine.
Added detailed comments explaining this is a workaround and where the real fix should go.
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
- Each 7Zip file now gets a fresh decompression stream instead of reusing shared streams
- Added SyncOnlyStream wrapper to force async operations to use synchronous equivalents
- This avoids LZMA decoder state corruption bugs in async operations
- Performance trade-off: slower async extraction for 7Zip but correctness guaranteed
- Documented behavior and performance implications in FORMATS.md
All 14 ExtractAll tests now pass (both async and sync)
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
- Restored original async ExtractAllEntries test with using statement
- Added new ExtractAllEntriesSync test (all tests pass)
- Fixed potential partial read bug in LzmaStream.DecodeChunkHeaderAsync
- Added ReadFullyAsync helper to ensure complete reads
- ReadAsync is not guaranteed to return all requested bytes
- Async tests for 7Zip still failing with Data Error
- Issue appears related to LZMA2 stream state management
- _needDictReset flag not being cleared correctly in async flow
- Further investigation needed
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
- TarWriterOptions now has a property that allows the user to select writing the TAR using the USTAR header format
- if unspecified, will default to the original modern GNU TAR header format
- default behavior is unchanged
- Updated target frameworks to net48;net8.0;net10.0 only
- Removed netstandard2.0 and net481 package conditions
- Updated conditional compilation to use NETFRAMEWORK only
- Updated package description and README
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
- Updated SharpCompress.csproj target frameworks from net48;net481;netstandard2.0;net6.0;net8.0 to net48;net481;netstandard2.0;net8.0;net10.0
- Updated test and build projects to use .NET 10
- Updated global.json to .NET 10 SDK
- Updated CI workflow to use .NET 10
- Fixed deprecated Rfc2898DeriveBytes constructor for .NET 10 (SYSLIB0060)
- Updated package description and README to reflect new supported frameworks
- Updated package versions for .NET 10 compatibility
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>