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

Closed
opened 2026-11-26 20:18:56 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/714
Author: @aslan2142
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142

Base: main ← Head: gamedata-spatial-grid-region3


📝 Commits (1)

  • 15f30f0 gamedata_blobs: Region 1's lowest cell offset decides where Region 3 starts

📊 Changes

2 files changed (+85 additions, -2 deletions)

View changed files

📝 tests/test_gamedata_blobs.py (+57 -2)
📝 tools/gamedata_blobs.py (+28 -0)

📄 Description

Claimed in the coordination issue as: OLD-7263 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7131834439

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).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/714 **Author:** [@aslan2142](https://github.com/aslan2142) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `gamedata-spatial-grid-region3` --- ### 📝 Commits (1) - [`15f30f0`](https://github.com/ubiquitarianism/leonida/commit/15f30f0a9758848daaf8bd7f923dc8beeaa8050f) gamedata_blobs: Region 1's lowest cell offset decides where Region 3 starts ### 📊 Changes **2 files changed** (+85 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_gamedata_blobs.py` (+57 -2) 📝 `tools/gamedata_blobs.py` (+28 -0) </details> ### 📄 Description Claimed in the coordination issue as: OLD-7263 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7131834439 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). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:56 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#753
No description provided.