OLD-7263: restore old upstream PR 7263 - gamedata_blobs: Region 1's lowest cell offset decides where Region 3 starts #714

Manually merged
github merged 1 commit from gh-pr/714/head into gh-pr/714/base 2026-11-26 09:17:40 +00:00
Owner

@⁠aslan2142 on GitHub · 2026-11-24 12:45 UTC · original
aslan2142:gamedata-spatial-grid-region3 → main · +85 −2 · 2 files · 1 commits · merged 2026-11-25 22:24 UTC

Claimed in the coordination issue as: OLD-7263 #14

Restoration of my original pull request, old upstream PR 7263 in ItsNotRexed/Leonida, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at 21625bca8c; the commit applied without conflicts and the code is unchanged; only the commit message changed, citing the old finding's number as plain text.

What and why

  • parse_spatial_grid_blob found Region 3 as the trailing run of 4-byte-aligned words below the blob size.
  • When the last word or words of Region 2 happen to look like such an offset, the run took them in. Region 3 then started too early, and a valid grid was rejected with "Region 3 start ... does not match lowest cell offset ..." or "Region 3 offset leaves Region 2 bounds".
  • docs/gamedata.md locates Region 3 as the trailing run matching min(cell_offs). The run is now only the search range. Region 3 starts at the lowest start in it where Region 1 (which ends at the lowest Region 3 word) has that start as its lowest cell offset.
  • Blobs that main accepts parse the same. If no start agrees, the existing checks still reject the blob.
  • Finding and repro by cynbun in the old repository.

Tested

Linux, Python 3.14, CPU only, synthetic blobs built in the test (no game files):

  • python -I tests/test_gamedata_blobs.py: on main with only this PR's test changes, 4 of 10 tests error (three colliding-word subtests and the multi-word Region 2 tail). On this branch, all 10 pass.
  • New tests cover the finding's repro with several colliding last words, a run of three colliding Region 2 words, truncated blobs, and a skipped first Region 3 word that has no consistent split.
  • python -m compileall -q tools tests, git diff --check and python -I scripts/check_no_game_data.py on the changed files: clean.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

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

**@⁠aslan2142** on GitHub · 2026-11-24 12:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/714) `aslan2142:gamedata-spatial-grid-region3` → `main` · +85 −2 · 2 files · 1 commits · merged 2026-11-25 22:24 UTC Claimed in the coordination issue as: OLD-7263 https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 Restoration of my original pull request, old upstream PR 7263 in `ItsNotRexed/Leonida`, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at 21625bca8c675c62f9dbffc318ce6a59d57faf31; the commit applied without conflicts and the code is unchanged; only the commit message changed, citing the old finding's number as plain text. ### What and why - `parse_spatial_grid_blob` found Region 3 as the trailing run of 4-byte-aligned words below the blob size. - When the last word or words of Region 2 happen to look like such an offset, the run took them in. Region 3 then started too early, and a valid grid was rejected with "Region 3 start ... does not match lowest cell offset ..." or "Region 3 offset leaves Region 2 bounds". - `docs/gamedata.md` locates Region 3 as the trailing run matching `min(cell_offs)`. The run is now only the search range. Region 3 starts at the lowest start in it where Region 1 (which ends at the lowest Region 3 word) has that start as its lowest cell offset. - Blobs that main accepts parse the same. If no start agrees, the existing checks still reject the blob. - Finding and repro by cynbun in the old repository. ### Tested Linux, Python 3.14, CPU only, synthetic blobs built in the test (no game files): - `python -I tests/test_gamedata_blobs.py`: on main with only this PR's test changes, 4 of 10 tests error (three colliding-word subtests and the multi-word Region 2 tail). On this branch, all 10 pass. - New tests cover the finding's repro with several colliding last words, a run of three colliding Region 2 words, truncated blobs, and a skipped first Region 3 word that has no consistent split. - `python -m compileall -q tools tests`, `git diff --check` and `python -I scripts/check_no_game_data.py` on the changed files: clean. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) AI-assisted (Claude Code, Claude Opus 5.5).
parse_spatial_grid_blob found Region 3 as the trailing run of 4-byte-aligned
words below the blob size. When the last word(s) of Region 2 happen to be such
a value, the run took them in, Region 3 started too early and a valid grid was
rejected ("Region 3 start ... does not match lowest cell offset ..." or
"Region 3 offset leaves Region 2 bounds").

docs/gamedata.md (the 0x23c000 row) locates Region 3 as the trailing run
matching min(cell_offs). The run is now only the search range: Region 3 starts
at the lowest start in it where Region 1 (which ends at the lowest Region 3
word) has that start as its lowest cell offset. Blobs main accepted parse the
same; with no agreeing start the old checks still reject the blob.

Tests: cynbun's repro with several colliding last words, a run of three
colliding Region 2 words, truncated blobs, and a skipped first Region 3 word
that has no consistent split. The colliding cases fail on main.

Finding by cynbun in old upstream 7049 (old numbers link nowhere now).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:17:39 +00:00
github manually merged commit 15f30f0a97 into gh-pr/714/base 2026-11-26 09:17:40 +00:00
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-25 22:24 UTC · original

Merged: gamedata_blobs: Region 1's lowest cell offset decides where Region 3 starts.

  • Changed since review: Nothing. It merges cleanly with main, and no review point is open.
  • Tested: tests/test_gamedata_blobs.py passes on main + this head (Linux, CPython 3.14).
  • Checked on main eaa3792fd + 15f30f0a9: the semantic suite passes (492 files, 6,315 tests, 0 files failed); test_gamedata_blobs pass; the 15 docs and writer tests pass; check_no_game_data.py is clean on the 2 changed files.

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

**@⁠aslan2142** on GitHub · 2026-11-25 22:24 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/714#issuecomment-7176322089) Merged: `gamedata_blobs`: Region 1's lowest cell offset decides where Region 3 starts. - **Changed since review:** Nothing. It merges cleanly with `main`, and no review point is open. - **Tested:** `tests/test_gamedata_blobs.py` passes on `main` + this head (Linux, CPython 3.14). - **Checked on `main` `eaa3792fd` + `15f30f0a9`:** the semantic suite passes (492 files, 6,315 tests, 0 files failed); `test_gamedata_blobs` pass; the 15 docs and writer tests pass; `check_no_game_data.py` is clean on the 2 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.