feat: reject ZIP archives with unsupported Deflate64 compression up front#157
Merged
feat: reject ZIP archives with unsupported Deflate64 compression up front#157
Conversation
Coverage Report for CI Build 24793702738Coverage increased (+0.09%) to 76.947%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
2cd4cd4 to
fb80897
Compare
…ront - Add a central-directory preflight that scans ZIP entries for methods libarchive cannot decode (currently Deflate64 / method 9) and fails fast with a new Error::UnsupportedZipCompression listing the offending entries - Wire the preflight into list_archive_files, uncompress_archive, and ArchiveIterator so the error surfaces before libarchive aborts mid-stream - Replace AsyncReadWrapper::seek's unreachable!() with ErrorKind::Unsupported so the preflight degrades gracefully on unseekable async readers - Cover the behavior with regression tests and a Deflate64 fixture - Note the change in CHANGES.md Closes #136
fb80897 to
802f79c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Error::UnsupportedZipCompression(Vec<(String, u16)>)listing the offending entries.list_archive_files,uncompress_archive,uncompress_archive_file, andArchiveIteratorso the error surfaces before libarchive aborts mid-stream withUnsupported ZIP compression method (9: deflation-64-bit).AsyncReadWrapper::seek'sunreachable!()withErrorKind::Unsupportedso the preflight degrades gracefully on unseekable async readers (channel-fed wrappers) instead of panicking.Closes #136.
Design notes
Vec<(String, u16)>) rather than a formattedError::Extraction(String), so callers can pattern-match on offending entries and their method numbers.archive_read_add_passphrase; Support encryption? #82 tracks exposing that from this crate. Blocking encrypted entries now would preempt that work. A comment inis_unsupported_methoddocuments the decision.Test plan
list_archive_files,uncompress_archive,ArchiveIterator::from_read) on a Deflate64 fixture, plus a guard that plain-Deflate (method 8) archives remain unaffected.AsyncReadWrapper::seekfallback path).cargo clippy --all-targetsclean with default and async features.Fixture
tests/fixtures/deflate64.zip(229 B) — generated with7z a -tzip -mm=Deflate64over a repeated-string payload large enough that 7-Zip actually picks Deflate64 instead of Store. ConfirmedMethod = Deflate64via7z l -slt.