Fix ZIP64 stream bounding and WinZip AES read-state corruption in ZIP reader#1253
Fix ZIP64 stream bounding and WinZip AES read-state corruption in ZIP reader#1253adamhathcock merged 8 commits intoreleasefrom
Conversation
…st can't clean up
Proper test file clean up
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (10 files)
Review DetailsThe PR implements important bug fixes and test coverage for ZIP handling:
The code changes follow existing patterns in the codebase and the test coverage is thorough. |
same as #1247 but against release
This pull request makes several important improvements and bug fixes to the WinZip AES decryption logic in
WinzipAesCryptoStream, adds comprehensive tests for this functionality, and enhances the test infrastructure for better isolation and reliability. It also introduces new tests for Zstandard-compressed and Zip64 archives, ensuring broader coverage and correctness.WinZip AES decryption logic improvements
WinzipAesCryptoStreamto correctly preserve the keystream position across non-aligned reads, both for synchronous and asynchronous operations. This fixes issues where partial reads could corrupt decryption state, especially with buffer sizes not aligned to the AES block size. (WinzipAesCryptoStream.cs,WinzipAesCryptoStream.Async.cs) [1] [2] [3]_counterOutOffset) and to refill it as needed, ensuring correct XOR operations across read boundaries. (WinzipAesCryptoStream.cs,WinzipAesCryptoStream.Async.cs) [1] [2] [3]Test coverage enhancements
WinzipAesCryptoStreamTeststo verify correct decryption for aligned and non-aligned reads, both sync and async, and to ensure the stream stops at the correct payload length. These tests also verify keystream preservation across chunked reads. (WinzipAesCryptoStreamTests.cs)TestBase.cs) [1] [2] [3]Zip archive handling and new tests
ZipArchiveTests.cs) [1] [2]ZipArchiveTests.cs) [1] [2] [3]Minor bug fixes
ZipFilePartto simplify stream handling for certain ZIP header conditions. (ZipFilePart.cs,ZipFilePart.Async.cs) [1] [2]These changes collectively improve the reliability, correctness, and test coverage of ZIP AES decryption and ZIP archive handling in the library.