gdk_runtime_calls: bound x86 decoding (X86-DECODE-WINDOW) #1041

Manually merged
github merged 1 commit from gh-pr/1041/head into gh-pr/1041/base 2026-11-26 09:34:50 +00:00
Owner

@⁠Taffyyy-ops on GitHub · 2026-11-24 17:07 UTC · original
Taffyyy-ops:fix/x86-decode-window → main · +58 −1 · 2 files · 1 commits · merged 2026-11-24 22:18 UTC

Claimed in the coordination issue as: X86-DECODE-WINDOW

What and why

Bound the shared x86 decoder to its 15-byte instruction window before scanning prefixes or operands. Previously, a long invalid prefix run scanned the entire remaining buffer before rejection. Invalid offsets now return None without reading the buffer.

Tested

74 unittest tests passed on Windows, including four new synthetic regression tests. The regression tests fail against the original decoder.
Coverage: decode window, GDK runtime calls, import fail-fast, import call sites, int3 cause, text line endings.
check_no_game_data.py and git diff --check passed.

GPUs tested: n/a; CPU-only Python change.
AI-assisted: yes.

**@⁠Taffyyy-ops** on GitHub · 2026-11-24 17:07 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1041) `Taffyyy-ops:fix/x86-decode-window` → `main` · +58 −1 · 2 files · 1 commits · merged 2026-11-24 22:18 UTC Claimed in the coordination issue as: X86-DECODE-WINDOW ### What and why Bound the shared x86 decoder to its 15-byte instruction window before scanning prefixes or operands. Previously, a long invalid prefix run scanned the entire remaining buffer before rejection. Invalid offsets now return None without reading the buffer. ### Tested 74 unittest tests passed on Windows, including four new synthetic regression tests. The regression tests fail against the original decoder. Coverage: decode window, GDK runtime calls, import fail-fast, import call sites, int3 cause, text line endings. check_no_game_data.py and git diff --check passed. GPUs tested: n/a; CPU-only Python change. AI-assisted: yes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:34:49 +00:00
github manually merged commit 3efede977f into gh-pr/1041/base 2026-11-26 09:34:50 +00:00
Author
Owner

@⁠morodirule on GitHub · 2026-11-24 17:07 UTC · original

Independent Linux check (stdlib only, no game/GPU): 4/4 pass on head 3efede977. Same file against the unmodified decoder fails 2 tests + 1 error — reads rescan up to offset 4103 (unbounded tail rescan) and out-of-range offsets error instead of returning None — so the new tests pin exactly the reported behavior. Not claiming; review evidence.

**@⁠morodirule** on GitHub · 2026-11-24 17:07 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1041#issuecomment-7138726495) Independent Linux check (stdlib only, no game/GPU): 4/4 pass on head 3efede977. Same file against the unmodified decoder fails 2 tests + 1 error — reads rescan up to offset 4103 (unbounded tail rescan) and out-of-range offsets error instead of returning None — so the new tests pin exactly the reported behavior. Not claiming; review evidence.
Author
Owner

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

Verified on exact head 3efede977f (base d4de3a7df9). All reported focused Linux suites pass: decode-window 4/4, GDK runtime calls 23/23, import fail-fast 8/8, import call sites 21/21, int3 cause 15/15, line endings 3/3 (74 total). The changed files pass no-game-data and git diff --check; the patch merges cleanly onto the newer current main. The regression observes byte reads and verifies long prefix runs are capped at 15 bytes, truncated operands fail, valid 15-byte instructions decode, and invalid offsets read nothing. Synthetic CPU-only tests.

**@⁠KernelSmoker** on GitHub · 2026-11-24 17:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1041#pullrequestreview-6044028089) · **approved these changes** Verified on exact head 3efede977f82be464e518e099441a6aced010227 (base d4de3a7df9438bb0781d8d7c8f7f169a2616279f). All reported focused Linux suites pass: decode-window 4/4, GDK runtime calls 23/23, import fail-fast 8/8, import call sites 21/21, int3 cause 15/15, line endings 3/3 (74 total). The changed files pass no-game-data and `git diff --check`; the patch merges cleanly onto the newer current main. The regression observes byte reads and verifies long prefix runs are capped at 15 bytes, truncated operands fail, valid 15-byte instructions decode, and invalid offsets read nothing. Synthetic CPU-only tests.
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 22:18 UTC · original

Merging.

Why merged: X86-DECODE-WINDOW: gdk_runtime_calls.decode reads at most 15 bytes (the x86 maximum) and rejects out-of-range offsets. morodirule showed the new test fails on the base, and KernelSmoker checked it.

Why it's good: Its tests plus the related gdk, import_call_sites, import_fail_fast, int3_cause and first_look tests: 74 passed.

Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 4a50cafc7. 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: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls, new subprocesses, new env vars or CI changes.

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

**@⁠QemmHD** on GitHub · 2026-11-24 22:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1041#issuecomment-7146070786) Merging. **Why merged:** X86-DECODE-WINDOW: gdk_runtime_calls.decode reads at most 15 bytes (the x86 maximum) and rejects out-of-range offsets. morodirule showed the new test fails on the base, and KernelSmoker checked it. **Why it's good:** Its tests plus the related gdk, import_call_sites, import_fail_fast, int3_cause and first_look tests: 74 passed. Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 4a50cafc7. 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: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls, new subprocesses, new env vars or CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.