OLD-7301: psin_psch: reject overlapping PMAP blocks and duplicate consumed sections #873

Manually merged
github merged 1 commit from gh-pr/873/head into gh-pr/873/base 2026-11-26 09:25:39 +00:00
Owner

@⁠narekshaghoyandev on GitHub · 2026-11-24 14:52 UTC · original
narekshaghoyandev:ubiq-psin-psch-pmap-overlap-and-dup-sections → main · +50 −1 · 2 files · 1 commits · merged 2026-11-24 21:04 UTC

Reopening my original upstream PR #7301 (previously approved by @devnull34, refined per @SirKingg's review, and re-verified 57/57 on retail PSIN streams by @Kev-Ball), cleanly rebased onto main:

  1. Reject overlapping non-empty PMAP blocks: Sorts non-empty (length > 0) PMAP blocks by offset and rejects any true byte-range overlap regardless of table row order (allowing empty blocks and non-monotonic non-overlapping rows).
  2. Reject duplicate consumed sections: Rejects duplicate occurrences of the 6 consumed PSIN section tags (PMAP, PSCH, PSIG, STNS, STDN, STFN) instead of silently overwriting earlier sections in the section dict, while allowing repeated unknown/ignored section tags.

Verification

  • python3 -I tests/test_psin_psch.py -v: 4/4 pass (negative control on main fails on test_rejects_overlapping_pmap_blocks_and_duplicate_known_sections).
  • python3 -I scripts/check_no_game_data.py tools/psin_psch.py tests/test_psin_psch.py: clean.
  • python3 -m compileall -q tools/psin_psch.py tests/test_psin_psch.py: clean.

Claimed in the coordination issue as: OLD-7301 (#14)
AI-assisted: yes (Gemini)

**@⁠narekshaghoyandev** on GitHub · 2026-11-24 14:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/873) `narekshaghoyandev:ubiq-psin-psch-pmap-overlap-and-dup-sections` → `main` · +50 −1 · 2 files · 1 commits · merged 2026-11-24 21:04 UTC Reopening my original upstream PR #7301 (previously approved by `@devnull34`, refined per `@SirKingg`'s review, and re-verified 57/57 on retail PSIN streams by `@Kev-Ball`), cleanly rebased onto `main`: 1. **Reject overlapping non-empty `PMAP` blocks**: Sorts non-empty (`length > 0`) `PMAP` blocks by offset and rejects any true byte-range overlap regardless of table row order (allowing empty blocks and non-monotonic non-overlapping rows). 2. **Reject duplicate consumed sections**: Rejects duplicate occurrences of the 6 consumed PSIN section tags (`PMAP`, `PSCH`, `PSIG`, `STNS`, `STDN`, `STFN`) instead of silently overwriting earlier sections in the section dict, while allowing repeated unknown/ignored section tags. ### Verification - `python3 -I tests/test_psin_psch.py -v`: 4/4 pass (negative control on `main` fails on `test_rejects_overlapping_pmap_blocks_and_duplicate_known_sections`). - `python3 -I scripts/check_no_game_data.py tools/psin_psch.py tests/test_psin_psch.py`: clean. - `python3 -m compileall -q tools/psin_psch.py tests/test_psin_psch.py`: clean. Claimed in the coordination issue as: OLD-7301 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) AI-assisted: yes (Gemini)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:25:37 +00:00
github manually merged commit f16674ec39 into gh-pr/873/base 2026-11-26 09:25:39 +00:00
Author
Owner

@⁠KernelSmoker on GitHub · 2026-11-24 14:56 UTC · original · approved these changes

Reviewed exact head f16674ec39787400cf9b18dea36e1d0116a7ce81 against base 8f05e09e224656740e8a53f5047e1338d7a52588. PMAP blocks are checked as half-open byte ranges after sorting non-empty entries, preserving disjoint out-of-order/empty blocks; duplicate rejection is limited to sections the parser consumes, while unknown repeated sections remain accepted. python3 -I tests/test_psin_psch.py -v passes 4/4; Python compilation and git diff --check pass. All fixtures synthetic; CPU-only. Hosted checks were pending at review time.

**@⁠KernelSmoker** on GitHub · 2026-11-24 14:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/873#pullrequestreview-6041613969) · **approved these changes** Reviewed exact head `f16674ec39787400cf9b18dea36e1d0116a7ce81` against base `8f05e09e224656740e8a53f5047e1338d7a52588`. PMAP blocks are checked as half-open byte ranges after sorting non-empty entries, preserving disjoint out-of-order/empty blocks; duplicate rejection is limited to sections the parser consumes, while unknown repeated sections remain accepted. `python3 -I tests/test_psin_psch.py -v` passes 4/4; Python compilation and `git diff --check` pass. All fixtures synthetic; CPU-only. Hosted checks were pending at review time.
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 14:57 UTC · original · approved these changes

Audited and verified. Rejects overlapping non-empty PMAP blocks in ools/psin_psch.py:decode_pmap and raises ValueError on duplicate consumed sections in parse_psch_container rather than silently overwriting. Unit tests in ests/test_psin_psch.py pass cleanly. Approved.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 14:57 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/873#pullrequestreview-6041616264) · **approved these changes** Audited and verified. Rejects overlapping non-empty PMAP blocks in ools/psin_psch.py:decode_pmap and raises ValueError on duplicate consumed sections in parse_psch_container rather than silently overwriting. Unit tests in ests/test_psin_psch.py pass cleanly. Approved.
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 21:04 UTC · original

Merging.

Why merged: OLD-7301: psin_psch rejects overlapping non-empty PMAP blocks and duplicate consumed sections, so malformed input is refused instead of misread. KernelSmoker approved this exact head.

Why it's good: Pure parsing. Own tests: 4 passed.

Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 66d4f5aa3. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests) gives 573 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main 0b45fdc21: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls, new env vars or build/CI changes.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠QemmHD** on GitHub · 2026-11-24 21:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/873#issuecomment-7144431361) Merging. **Why merged:** OLD-7301: psin_psch rejects overlapping non-empty PMAP blocks and duplicate consumed sections, so malformed input is refused instead of misread. KernelSmoker approved this exact head. **Why it's good:** Pure parsing. Own tests: 4 passed. Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 66d4f5aa3. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests) gives 573 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main 0b45fdc21: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls, new env vars or build/CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.