mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:50:52 +01:00
[PR #1523] psin_psch: fix PMAP exact_end, schema checks, head handling, and carve-dir/atomic JSON I/O (PSIN-PSCH-VALIDATION-AND-IO-HARDENING) #1551
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#1551
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/1523
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/psin-psch-hardening📝 Commits (1)
64b23f4psin_psch: fix PMAP exact_end, schema descriptor checks, head handling, and carve-dir/atomic JSON I/O (PSIN-PSCH-VALIDATION-AND-IO-HARDENING)📊 Changes
2 files changed (+201 additions, -19 deletions)
View changed files
📝
tests/test_psin_psch.py(+131 -0)📝
tools/psin_psch.py(+70 -19)📄 Description
Summary
Fixes several concrete bugs and hardens validation and report I/O in
tools/psin_psch.py:exact_endcalculation (decode_pmap): computes the data-area end frommax(b["offset"] + b["length"] for b in blocks)instead of row-orderblocks[-1], so valid PMAP tables with a trailing empty block or out-of-order final row are no longer falsely rejected.check_psch_schema): rejects self-referencingPSCH_TYPE_ARRAY(elem_idx == idx) andPSCH_TYPE_MAP(k_idx == idx/v_idx == idx) descriptors and reports duplicate struct or enum hashes inPSCHinstead of silently overwriting earlier entries.headrow filtering (_has_psin_head,scan_target): handlesNone/non-stringheadfields in carveindex.jsonrows without raising an uncaughtAttributeError, and matches uppercase"5053494E"prefixes as well as lowercase.--carve-dir& pre-parse overwrite protection (check_report_path,main): checks.binpayloads inside--carve-dirviagm.check_report_path(not onlyindex.json), and runs the initialcheck_report_pathguard before readingindex.jsonso--json <dir>/index.jsonstill exits 2 even whenindex.jsonis corrupt._write_json,main): stages--jsonoutput in a sibling temp file withnewline="\n", trailing LF,allow_nan=False,file_mode.published_mode, andreplace_retry.replace, preserving pre-existing files on failure.Coordination
PSIN-PSCH-VALIDATION-AND-IO-HARDENING(https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7151838167)Testing
python3 -I tests/test_psin_psch.py -v— 9/9 OK (including 5 new regression tests)python3 -I tests/test_missing_input_exit_codes.py— 2/2 OKpython3 -I tests/test_text_write_line_endings.py— 3/3 OKpython3 -I scripts/check_no_game_data.py tools/psin_psch.py tests/test_psin_psch.py— cleanpython3 -m compileall -q tools/psin_psch.py tests/test_psin_psch.py— cleanmain:tools/psin_psch.py: 5/5 new tests fail (FAILED (failures=3, errors=2)).Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.