meshlet_page: validate RPF9 archive headers before scanning meshlet pages (OLD-9986) #1230

Open
github-bot wants to merge 1 commit from github-bot/gh-1230 into main AGit
Owner

@⁠IlyassRS3 on GitHub · 2026-11-24 20:37 UTC · original
IlyassRS3:carry/old-9986-meshlet-rpf9-header → main · +39 −3 · 2 files · 1 commits · open

What changed

Carries forward old-pr/9986 (draft #254, original commit by @⁠lucastayaralvarenga-ui) rebased cleanly onto current main (705ea0910), preserving the original author commit.

  • tools/meshlet_page.py: validate the RPF9 archive header in iter_archive() before scanning for zlib streams — refuse files shorter than 8 bytes or without RPF9/9FPR magic (<path>: not an RPF9 archive), and refuse data-area start offsets outside [8, size] (<path>: RPF9 data start is outside the archive), raising PageError so the CLI exits 2 without writing a misleading 0-page JSON report.
  • tests/test_meshlet_page.py: add test_invalid_archive_header_is_refused_before_writing_a_report (5 invalid header cases) and test_header_only_archive_can_have_zero_pages.

Item ID

  • Coordination issue #14 item: OLD-9986 (carries forward old-pr/9986 / draft #254, #17)
  • Depends on: none

Verification

Tested on macOS 27.2.1 (Apple M5 arm64), Python 3.14 (no game files, no GPU, standard library only):

  • python3 -I tests/test_meshlet_page.py -v -> 73/73 OK
  • Revert-source mutation check (reverting tools/meshlet_page.py to upstream/main while keeping tests/test_meshlet_page.py) -> FAILED (5 failures): all 5 invalid header cases silently returned exit code 0 instead of 2; restoring the fix returns to 73/73 OK.
  • python3 -m compileall -q tools/meshlet_page.py tests/test_meshlet_page.py -> OK
  • python3 -I scripts/check_no_game_data.py tools/meshlet_page.py tests/test_meshlet_page.py -> OK
  • python3 -I tests/test_ci_registration.py -> 15/15 OK
  • python3 -I tests/test_text_write_line_endings.py -> 3/3 OK

Checklist

  • No game files, binaries, shaders, textures, audio, or logs quoting them
  • No keys, decryption, or online services
  • Claimed in the coordination issue (#14) before opening this PR
  • AI-assisted: yes (carried forward, audited, rebased, and regression-verified with AI assistance; original commit by @⁠lucastayaralvarenga-ui preserved)
**@⁠IlyassRS3** on GitHub · 2026-11-24 20:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1230) `IlyassRS3:carry/old-9986-meshlet-rpf9-header` → `main` · +39 −3 · 2 files · 1 commits · open ## What changed Carries forward `old-pr/9986` (draft #254, original commit by @⁠lucastayaralvarenga-ui) rebased cleanly onto current `main` (`705ea0910`), preserving the original author commit. - `tools/meshlet_page.py`: validate the RPF9 archive header in `iter_archive()` before scanning for zlib streams — refuse files shorter than 8 bytes or without `RPF9`/`9FPR` magic (`<path>: not an RPF9 archive`), and refuse data-area start offsets outside `[8, size]` (`<path>: RPF9 data start is outside the archive`), raising `PageError` so the CLI exits 2 without writing a misleading 0-page JSON report. - `tests/test_meshlet_page.py`: add `test_invalid_archive_header_is_refused_before_writing_a_report` (5 invalid header cases) and `test_header_only_archive_can_have_zero_pages`. ## Item ID - Coordination issue #14 item: `OLD-9986` (carries forward `old-pr/9986` / draft #254, #17) - Depends on: none ## Verification Tested on macOS 27.2.1 (Apple M5 arm64), Python 3.14 (no game files, no GPU, standard library only): - `python3 -I tests/test_meshlet_page.py -v` -> **73/73 OK** - Revert-source mutation check (reverting `tools/meshlet_page.py` to `upstream/main` while keeping `tests/test_meshlet_page.py`) -> **FAILED (5 failures)**: all 5 invalid header cases silently returned exit code `0` instead of `2`; restoring the fix returns to 73/73 OK. - `python3 -m compileall -q tools/meshlet_page.py tests/test_meshlet_page.py` -> OK - `python3 -I scripts/check_no_game_data.py tools/meshlet_page.py tests/test_meshlet_page.py` -> OK - `python3 -I tests/test_ci_registration.py` -> **15/15 OK** - `python3 -I tests/test_text_write_line_endings.py` -> **3/3 OK** ## Checklist - [x] No game files, binaries, shaders, textures, audio, or logs quoting them - [x] No keys, decryption, or online services - [x] Claimed in the coordination issue (#14) before opening this PR - [x] AI-assisted: yes (carried forward, audited, rebased, and regression-verified with AI assistance; original commit by @⁠lucastayaralvarenga-ui preserved)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:43:46 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-24 20:37 UTC · original · reviewed

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-24 20:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1230#pullrequestreview-6047010761) · **reviewed** Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1230/head:github-bot/gh-1230'
git switch 'github-bot/gh-1230'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1230'
git switch 'github-bot/gh-1230'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1230'
git switch 'github-bot/gh-1230'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1230'
git switch 'main'
git merge --squash 'github-bot/gh-1230'
git switch 'main'
git merge --ff-only 'github-bot/gh-1230'
git switch 'main'
git merge 'github-bot/gh-1230'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.