Repository navigation
Fix four review findings left open on merged PRs (#318, #343, #347, #356) - #370
Merged
Merged
Conversation
xbmc4lyfe
force-pushed
the
codex-thread-fixes
branch
from
November 30, 2026 16:34
533576b to
775db92
Compare
) - zip (7z cut mode, Emit): a cut stored streamed member whose bytes match its CRC (none, or bytes with CRC32 0) now fails as truncated instead of reading as verified: a successful read is checked against the gap too. - 7z verify_next_header: the signature header, the next header and an encoded header's packed stream are charged to header_bytes as the member map charges them, so verify and the map agree on the limit. - RAR 4.x cut file header whose fields name an unsupported method or unpack version is blocked like a nameless one: keep_broken no longer publishes an empty file over an existing one. - 7z default lzma2_parallel_bytes: on Linux, the lower of physical memory and the cgroup memory limit (v2 memory.max, v1 memory.limit_in_bytes), parsed with a checked pure function and read once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gYJFfVCupfunL2idYi
The whole-archive run of a cut ZIP counted a stored streamed member whose bytes (or lack of them) match its CRC as extracted; it now fails at the gap as a member that doesn't check out does (kept with keep_broken). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gYJFfVCupfunL2idYi
…is the sole source of CRC and sizes A whole streamed member whose data descriptor alone sits in a missing volume, with a central directory stating its CRC and sizes, extracts again (7-Zip 26.06 extracts it); the descriptor is part of the member after a good read only for the last member of a local walk with no directory. The cut CRC-0 members still fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gYJFfVCupfunL2idYi
Collaborator
Author
xbmc4lyfe
force-pushed
the
codex-thread-fixes
branch
from
November 30, 2026 17:34
775db92 to
ab48538
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.
Fixes four review findings that were still present on main. Each one has a test that fails before its fix and passes after it.
1. ZIP 7z cut mode: a cut member that checks out was reported verified (PRRT_kwDOVi_ME8684gCe, #343)
Archive::read_truncated_at(src/zip.rs) now checksgap_crossedwhen a read succeeds. A stored streamed member (flag 0x0008, CRC and sizes 0) cut before its descriptor, with no bytes or with9d 0a d9 6d(CRC32 0), now fails asTruncatedunderSevenZip+Emit, as it already did underWithhold. The whole-archive run (extract::run) had the same gap: it counted such a member as an extracted file. It now fails it at the gap too, keeping the file withkeep_broken.Test:
tests/seven_zip_cut_member.rs::a_cut_stored_streamed_member_whose_bytes_match_crc_0_still_fails_as_cutcovers the empty, CRC-0 andabcdpayloads. It runsSelectedEntryunder Emit and Withhold, andextract::runin 7z mode and with salvage alone.After a read that checks out, the data descriptor counts as part of the member only when it is the only source of the member's CRC and sizes: the last member of a local walk with no directory (
gap_crossed_after_read). Otherwise only the data range is checked. So a whole streamed member whose descriptor alone sits in a missing volume, with a central directory giving its CRC and sizes, still extracts, as 7-Zip 26.06 extracts it (found in review; the first push of this PR regressed it).Test:
tests/zip_split_extract.rs::a_missing_volume_holding_only_a_data_descriptor_leaves_its_member_whole. In an Info-ZIP split withs.z02(holding only a.txt's descriptor) missing, both members extract in 7z mode and with salvage alone, and a selected read of a.txt returns the same bytes.2. 7z
verify_next_headerdidn't charge the whole header toheader_bytes(PRRT_kwDOVi_ME869VbS5, leftover of PRRT_kwDOVi_ME869VWrc, #356)parse_next_header(src/map/sevenzip.rs) now charges the 32-byte signature header plus the next header before parsing, and an encoded header's packed stream before decoding, as the member map's walk does. Verify and the map now agree on the limit.Test:
tests/sevenzip_headers.rs::verify_and_the_member_map_agree_on_the_header_bytes_limitfinds the map's smallest accepted limit for store_method.7z (151) and store_method_enc_headers.7z (283). Verify passes at that limit and fails one byte under it.3. A cut RAR 4.x header naming an unsupported method or version replaced an existing file (PRRT_kwDOVi_ME869WhMZ, #347)
blockedin src/rar5/session/selection/extraction.rs now covers a cut header (HeaderCut::Header) whoserar4_unsupported()is set. Before,keep_brokenpublished an empty file over an existing one underOverwrite::Always.Test:
tests/rar_cut_header.rs::a_cut_rar4_header_of_an_unsupported_method_or_version_keeps_the_existing_filecuts latest_winrar.rar at 58 and sets method 0x36 or version 99. The existing file stays and the member is still reported failed.4. The default 7z parallel LZMA2 budget ignored a container's memory limit (PRRT_kwDOVi_ME868ndWQ, #318)
default_lzma2_parallel_bytes(src/sevenzip.rs) now usesusable_memory(): on Linux, the lower of physical memory and the cgroup limit (v2/sys/fs/cgroup/memory.max, else v1/sys/fs/cgroup/memory/memory.limit_in_bytes). It reads at most 64 bytes, parses them with a checked pure function (max, v1's near-2^63 "no limit", 0, garbage and empty all give no limit) and caches the result once. The doc comment and docs/7z-extract.md are updated.Follow-up, not done here: only the cgroup mount root is read. Resolving the process's own cgroup through
/proc/self/cgroupand taking the minimum limit up the tree would also catch systemdMemoryMaxand limits set on parent cgroups.Tests: unit tests in
sevenzip::cgroup_memory_testscover v2 numbers,max, v1 huge values, overflow, garbage, signs, empty and 0, and check that usable memory is no more than physical memory.Checks run (macOS arm64)
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --locked -- -D warnings, plain and with--features persistent-partialsNot run: the full
/ci-local. The clean-room review compiled the cgroup code for x86_64-unknown-linux-musl under clippy-D warnings.Implemented clean-room, from the zipfast repo and observed behaviour only.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LG44gYJFfVCupfunL2idYi