textures: validate archive inputs and lookup keys upfront in texture_descriptors CLI #2657
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2665"
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 R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-26T01:32:59Z.
Change
Validate archive paths and
--lookup-keybounds upfront intools/texture_descriptors.pybefore opening any file, and add a pure-Python synthetic RDS5/ETPF CLI test suite (tests/texture_descriptors_cli_check.py) registered inCMakeLists.txtastextures_texture_descriptors_cli_check(TIMEOUT 60).len(args.archives) != 1when--lookup-keyis omitted immediately afterparse_args.0 <= key < (1 << 64)upfront in--lookup-keymode before opening archives.is_file()upfront before opening any archive, preserving the{archive}: {exc}stderr format and exit code1with zero tracebacks.Verification
47f5e5a1(based onupstream/main31bcd9ad)out\pe-env\Scripts\python.exe -B tests\texture_descriptors_cli_check.py->Ran 7 tests in 2.460s / OK(exit 0)out\pe-env\Scripts\python.exe -B tests\texture_descriptors_check.py->texture_descriptors: synthetic RDS5/ETPF helpers, JSON CLI modes, and error exits passed(exit 0)out\pe-env\Scripts\python.exe -B tests\form_coverage_check.py->form coverage checks passed(exit 0)out\pe-env\Scripts\python.exe -B tests\docs_links_check.py->Self-test passed. Checked 19 Markdown files and 510 links.(exit 0)out\pe-env\Scripts\python.exe -B tests\bidi_controls_check.py->Self-test passed. Checked 1893 tracked source, script and build/CI files: no bidirectional controls.(exit 0)--lookup-keyrange check,candidate.exists(),candidate.is_file()).--lookup-keywith mockedPath.openverifying zero opens), negative and>= 2^64keys, negative descriptor indices, truncated headers, corrupt zlib stream, duplicate/hardlink archives, and Python 3.14-safe argparse error exits.Evidence and follow-up
All fixtures in
tests/texture_descriptors_cli_check.pyare synthetic in-memory RDS5/ETPF byte buffers constructed by Python helper functions under the repository MIT license; no external or game files are used. Existingtools/texture_descriptors.pyJSON output shapes andtests/texture_descriptors_check.pyremain unchanged.Checklist
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T01:37:37Z.
Review: COMMENTED
Review of head
47f5e5a1against origin/main. No blocking findings.tools/texture_descriptors.py: the "multiple archives need --lookup-key" check now runs before anything else. Lookup keys are range-checked as unsigned 64-bit. Every archive is checked (exists, regular file) before any parsing starts. Behavior for valid input is unchanged.tests/texture_descriptors_cli_check.py(7 tests) is registered in CMake astextures_texture_descriptors_cli_check, next to the siblingtexture_descriptors_check.Commands run in a worktree on this head:
python3 -B tests/texture_descriptors_cli_check.py-> 7 tests OKpython3 -B tests/texture_descriptors_check.py-> OKpython3 tests/docs_links_check.py-> OKpython3 tests/bidi_controls_check.py-> OKgit diff --check origin/main...HEAD-> cleanPython-only change. A Windows receipt is still pending on my side.
AI-assisted; commands listed were executed locally.
upstream-sync referenced this pull request2026-11-26 13:03:00 +00:00