tombox-archive: block colliding entry names #244
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/244"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from omonkeyz/xbox-emulator. Originally posted by gringoestrangeiro on 2026-11-23T07:09:38Z.
Library / area:
tombox-archive(ZIP inventory + extraction-safety validator). No console exports change.Problem:
validate()looked at each central-directory name in isolation, so an archive could carry two entries that resolve to the same path on Windows and still be reported safe to extract. Examples:Game/Content/a.pakplusgame/content/A.PAK, or a fileGame/Contentplus a directorygame/content/. Extraction keeps whichever entry lands last, so the file on disk is not the inventory that was vetted.Change: track normalized names during validation and turn a collision into a blocking finding. Names are compared after separator normalization, trailing-slash removal and lowercasing, which catches case-only duplicates and file/directory collisions. Repeated directory entries stay allowed because they do not overwrite file data.
Tests:
cargo test --locked -p tombox-archivepasses (18 tests), including the new cases for a case-only duplicate, a file/directory collision, and distinct names plus repeated directories remaining safe. The PR gate reports 0 problems on the diff.cargo test -p tombox-archivepassesImported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-23T13:45:19Z.
Applied locally on main with your authorship kept (cherry-picked,
bb15e8e); tests pass in a sandbox. It ships in the next release; this PR will be closed when that is pushed. Thanks.Imported from omonkeyz/xbox-emulator. Originally posted by kiwe147 on 2026-11-23T19:15:07Z.
Tested head
7516c2d24e, applied withgit apply(whitespace ignored, the line endings of my checkout differ) onmainf89e410, together with #242, #248 (one tree; the PRs touch different files). It applied without conflicts and built.Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, NVIDIA GeForce RTX 3080 (driver 621.24), MSVC, Rust 1.91.1.
cargo test -p tombox-archiveNo new failure against
mainf89e410in any of these. This is one combined tree, not a run of this PR alone.AI-assisted: yes (Claude Code)
Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-25T13:09:12Z.
Applied on main in
bb15e8e(cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.Pull request closed