gdk_runtime_calls: bound x86 decoding (X86-DECODE-WINDOW) #1041
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!1041
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/x86-decode-window"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
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.
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.
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.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).