root_sig_contract: reject unpaired ptr64_lo on 1-dword tables and harden console/input validation (ROOT-SIG-CONTRACT-CONSOLE-AND-VALIDATION) #1606
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!1606
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/root-sig-contract-console-and-validation"
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?
Pull request successfully merged and closed
Item ID:
ROOT-SIG-CONTRACT-CONSOLE-AND-VALIDATION(unlisted; coordination issue #14 is at GitHub's 2,500-comment cap with no open successor at submission time, and no open PR touchestools/root_sig_contract.py).What changed
ptr64_lowithout a paired high dword (tools/root_sig_contract.py,reconcile): under--model console, descriptor tables occupy a single 32-bit dword (sub=0only). Previouslyptr64_lowithout an explicitpaironly checkedslot["sub"] != 0, silently accepting a 64-bit pointer low-half read on a 1-dword console table (asymmetric withptr64_hiand contradicting the explicitpaircheck). Nowptr64_lorequiresdwords[sgpr + 1]to besub=1of the same root parameter.--rootsigon an empty index under--model console(main): previously an emptyindex.json({}) looped over zero stages and exited0without ever callingpack_layout(sig, ...), accepting broken root signatures. Now an empty index still validatessigagainst the widest console stage (min(STAGE_BASE, key=STAGE_BASE.get)->cs, bases4), refusing malformed/oversized signatures while keeping valid console signatures accepted.stageunder--model console(main): exit2with a clearERROR:on stderr instead of stringifyingNone/ints into"None"/"4"and reporting a root-signature refusal.stage/kindvalues (pack_layout,reconcile,cluster): avoidTypeError: unhashable typewhen called programmatically with non-stringstageorkindvalues._load_json,main): open JSON inputs withutf-8-sigand reject whitespace-onlyindex/--rootsigarguments with a usage error.tests/test_root_sig_contract_edges.py): 7 new tests covering all of the above (no game files, no GPU).Verification
python3 -W error -I tests/test_root_sig_contract_edges.py -v: 13 passedpython3 -W error -m pytest tests/test_root_sig_contract.py -v: 58 passedpython3 -W error -I tests/test_text_write_line_endings.py: passedpython3 -I scripts/check_no_game_data.py tools/root_sig_contract.py tests/test_root_sig_contract_edges.py: cleanpython3 -m compileall -q tools/root_sig_contract.py tests/test_root_sig_contract_edges.py: cleantests/test_root_sig_contract_edges.pyagainst unpatchedmain:tools/root_sig_contract.py): 10 failures, 5 errors across the 13 tests (all new tests fail on unpatchedmain).Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 18 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13.
AI-assisted (Claude Code, Claude Opus 5.5)