Scripts: reject GDK vtable slots outside u8 #2648

Open
luckyteagirl wants to merge 1 commit from upstream-pr/2658 into main
luckyteagirl commented 2026-11-26 05:14:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T05:14:56Z.


gen_gdk_table.py accepts a vtable slot above 255 and overwrites the generated Rust table with a value that cannot fit its u8 field. Validate the slot width before opening the output file, so a bad input keeps the last usable table.

What is in it

  • Reject a parsed slot above 255 with a diagnostic that names the entry and value.
  • Add a temporary-tree CLI test that accepts slot 255, rejects 256, and checks that the generated bytes remain unchanged after rejection.

Tested

  • On current main b49be183, the new regression failed because slot 256 exited successfully and replaced the table. On this branch, full Python script discovery passed 26/26 on Windows; the focused CLI test independently passed.
  • git diff --check and an independent source review passed. Open PR #1267 reorganizes the same generator, so a mechanical rebase may be needed if it lands first.

Regression run

  • Not applicable. Only the Python generator and its test changed; the generated Rust table is unchanged.

Not tested

  • A real GDK header generation run, Rust workspace tests, GPU tests, or retail title smoke.

AI use

  • Codex (GPT-6.2 Sol) implemented and tested the change; another Codex Sol agent independently reviewed it.
<!-- greyfinch-sync:ivall/xcl:issue:5504429849 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2658). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T05:14:56Z. --- `gen_gdk_table.py` accepts a vtable slot above 255 and overwrites the generated Rust table with a value that cannot fit its `u8` field. Validate the slot width before opening the output file, so a bad input keeps the last usable table. **What is in it** - Reject a parsed slot above 255 with a diagnostic that names the entry and value. - Add a temporary-tree CLI test that accepts slot 255, rejects 256, and checks that the generated bytes remain unchanged after rejection. **Tested** - On current main `b49be183`, the new regression failed because slot 256 exited successfully and replaced the table. On this branch, full Python script discovery passed 26/26 on Windows; the focused CLI test independently passed. - `git diff --check` and an independent source review passed. Open PR #1267 reorganizes the same generator, so a mechanical rebase may be needed if it lands first. **Regression run** - Not applicable. Only the Python generator and its test changed; the generated Rust table is unchanged. **Not tested** - A real GDK header generation run, Rust workspace tests, GPU tests, or retail title smoke. **AI use** - Codex (GPT-6.2 Sol) implemented and tested the change; another Codex Sol agent independently reviewed it.
github-actions[bot] commented 2026-12-01 02:32:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:32:23Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7298725246 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2658#issuecomment-7298725246). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-12-01T02:32:23Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 08:36:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:36:14Z.


Triage (#1607) – head d489d6f

No open PR adds a slot range check to gen_gdk_table.py. #2681 (strip comments) and #2724 (validate GUIDs, stacked on #2681) change other parts of the script; the lines shared with them are the test's temp-dir setup. #1267 restructures the output code but adds no range check.
The generated table types the slot as u8, so exiting before the output file is opened for a slot over 255 keeps a bad row from replacing gdk_table.rs; the test checks that the old file is left unchanged. No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7305537989 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2658#issuecomment-7305537989). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:36:14Z. --- **Triage (#1607)** – head d489d6f No open PR adds a slot range check to gen_gdk_table.py. #2681 (strip comments) and #2724 (validate GUIDs, stacked on #2681) change other parts of the script; the lines shared with them are the test's temp-dir setup. #1267 restructures the output code but adds no range check. The generated table types the slot as `u8`, so exiting before the output file is opened for a slot over 255 keeps a bad row from replacing gdk_table.rs; the test checks that the old file is left unchanged. No problems found in the diff. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Decodere commented 2026-12-02 09:05:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T09:05:18Z.


merge-check
base: 1c8b551475
head: d489d6fbf2
merge: clean (git merge --no-edit onto 1c8b5514, git diff --check clean; scripts/gen_gdk_table.py and scripts/test_gen_gdk_table.py, +41/-0)
build: not run (Tier 0 Python generator diff; no Rust code changed)
tests: python -m unittest discover -s scripts -p "test_gen_gdk_table.py" -v -> 1 passed, 0 failed (new test file); python -m unittest discover -s scripts -p "test_*.py" -> 66 passed, 1 error (test_discord_mirror.py on Windows, same failure on base 1c8b5514). Rust workspace tests not run (Tier 0).
review: Read the full diff (+41/-0). Validates every parsed vtable slot fits in u8 (int(slot) > 255 exits with a diagnostic at scripts/gen_gdk_table.py:14-16) before opening gdk_table.rs for writing, so invalid input cannot overwrite the generated Rust file. The new test verifies slot 255 succeeds and slot 256 fails while preserving the prior output byte-for-byte. No problems found.
performance: none (offline table generator in scripts/; zero runtime impact)
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Python 3.15.2, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)

<!-- greyfinch-sync:ivall/xcl:comment:7340356945 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2658#issuecomment-7340356945). Originally posted by [Decodere](https://github.com/Decodere) on 2026-12-02T09:05:18Z. --- merge-check base: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f head: d489d6fbf200a46ac4f4d629e7bf9a70d1ceea1a merge: clean (`git merge --no-edit` onto `1c8b5514`, `git diff --check` clean; `scripts/gen_gdk_table.py` and `scripts/test_gen_gdk_table.py`, +41/-0) build: not run (Tier 0 Python generator diff; no Rust code changed) tests: `python -m unittest discover -s scripts -p "test_gen_gdk_table.py" -v` -> 1 passed, 0 failed (new test file); `python -m unittest discover -s scripts -p "test_*.py"` -> 66 passed, 1 error (`test_discord_mirror.py` on Windows, same failure on base `1c8b5514`). Rust workspace tests not run (Tier 0). review: Read the full diff (+41/-0). Validates every parsed vtable slot fits in `u8` (`int(slot) > 255` exits with a diagnostic at `scripts/gen_gdk_table.py:14-16`) before opening `gdk_table.rs` for writing, so invalid input cannot overwrite the generated Rust file. The new test verifies slot `255` succeeds and slot `256` fails while preserving the prior output byte-for-byte. No problems found. performance: none (offline table generator in `scripts/`; zero runtime impact) verdict: safe to merge hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Python 3.15.2, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2658:upstream-pr/2658'
git switch 'upstream-pr/2658'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2658'
git switch 'upstream-pr/2658'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2658'
git switch 'upstream-pr/2658'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2658'
git switch 'main'
git merge --squash 'upstream-pr/2658'
git switch 'main'
git merge --ff-only 'upstream-pr/2658'
git switch 'main'
git merge 'upstream-pr/2658'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
xcl-dev/xcl!2648
No description provided.