mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:50:52 +01:00
[PR #1606] root_sig_contract: reject unpaired ptr64_lo on 1-dword tables and harden console/input validation (ROOT-SIG-CONTRACT-CONSOLE-AND-VALIDATION) #1621
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1621
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1606
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/root-sig-contract-console-and-validation📝 Commits (1)
4cfb7c7root_sig_contract: reject unpaired ptr64_lo on 1-dword tables and harden console/input validation📊 Changes
2 files changed (+143 additions, -10 deletions)
View changed files
📝
tests/test_root_sig_contract_edges.py(+111 -0)📝
tools/root_sig_contract.py(+32 -10)📄 Description
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).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.