OLD-7883: audit_shader4_regs: harden stage map loading, bound PSV0 reads, and write JSON atomically #888
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/888"
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 ubiquitarianism/leonida. Originally posted by narekshaghoyandev on 2026-11-24T14:57:25Z.
Reopening my original upstream PR #7883 (previously verified on Windows 11 by
@TieruYT; zero overlap with #713--limit), cleanly rebased ontomain:load_stage_map): Readsindex.jsonwithutf-8-sig, guards malformed list entries and non-string/unhashablestagevalues, and catchesRecursionError.read_psv0): Rejects truncated DXBCPSV0chunks (off + 8 + plen > len(d)) and inner records whose declaredrsizeexceeds chunk payload bytes (4 + rsize > len(p)).write_json,main): Passesa.json_outdirectly toprotect_input, and publishes--jsonatomically viatempfile.mkstemp+file_mode.published_mode+replace_retry.replacewithallow_nan=Falseand read-only-safe temp cleanup.Verification
python3 -I tests/test_audit_shader4_regs.py -v: 23/23 pass (all 3 new tests fail/error againstmain).python3 -I scripts/check_no_game_data.py scripts/audit_shader4_regs.py tests/test_audit_shader4_regs.py: clean.python3 -m compileall -q scripts/audit_shader4_regs.py tests/test_audit_shader4_regs.py: clean.Claimed in the coordination issue as: OLD-7883 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135201067)
AI-assisted: yes (Gemini)
Imported from ubiquitarianism/leonida. Originally posted by KernelSmoker on 2026-11-24T15:04:00Z.
Review: APPROVED
Reviewed the exact submitted head
6c6d66fbb8b3b93740f3f7a9a9caca652cadb4db. The stage-map loader now tolerates malformed entries, BOM-prefixed JSON and recursion errors; PSV0 chunk and record lengths are bounded before slicing/unpacking; report-path collision checks protect inputs; and report publication is atomic with permission preservation and cleanup. Validation on Bazzite/Linux:python3 -I tests/test_audit_shader4_regs.py -v(20/20 passed),python3 -I -m py_compile scripts/audit_shader4_regs.py tests/test_audit_shader4_regs.py, andgit diff --checkall passed. Synthetic inputs only; no game data or GPU used.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T13:07:06Z.
Red/green: tests/test_audit_shader4_regs.py 5 failed on main, 23 passed with the PR.
Targeted batch of 30 PRs (their tests, the tests importing the changed modules, the docs tests, the translator suite) on main
a997a3c: no new failure, Windows 11 / Python.AI-assisted (Claude Code, Claude Opus 5.5)