Shaders: bound signature tables before allocating elements #1107

Open
anakatt wants to merge 1 commit from upstream-pr/1116 into main
anakatt commented 2026-11-24 11:56:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by anakatt on 2026-11-24T11:56:23Z.


I validate the complete DXBC signature table before allocating from its declared element count. Previously, a truncated final element could be accepted, and an oversized count reached allocation before the parser checked the table bounds.

What is in it

  • Checked table-size arithmetic and a bounds check before Vec::with_capacity.
  • Regression coverage for all six supported signature tags: truncated tables, oversized counts and offsets, and valid empty tables.

Tested

I ran the tests on Windows 11 Pro ARM64 10.0.26100.1742 in UTM (4 GiB RAM, virtual virt-10.0 CPU, Red Hat VirtIO GPU DOD), using Rust 1.100.0 x86_64-pc-windows-msvc and Visual Studio 2022 Build Tools. The guest used a source archive of main 47efa2ecea0a12934719ae69b81930cf02a4b1c3 plus the source changes committed as 24fd09fcfc29a323ab47770ecf132a05b46a63eb.

  • Before the fix, cargo test --locked -p xcl --lib gpu::dxbc::tests::rejects_signature_tables_outside_the_part -- --exact: 0 passed, 1 failed, 0 ignored, 719 filtered out. The truncated signature returned Some instead of None.
  • After the fix, cargo test --locked -p xcl --lib gpu::dxbc -- --test-threads=4: 3 passed, 0 failed, 0 ignored, 717 filtered out; no SKIPPED output.

Not tested

I have not run the full workspace suite, native x64 Windows hardware, D3D12 GPU execution, or a real game title. The VM's display adapter is not D3D12 GPU coverage.

Regression run

Not run. This remains a draft until both required real-title xcl-smoke blocks are available: one from main and one from this PR's clean head, using the same title and duration. The focused tests above do not replace those runs.

AI use

I used omp (openai-codex/gpt-6-astra) to investigate, implement the fix and regression, run the Windows tests, and prepare this PR.

<!-- greyfinch-sync:ivall/xcl:issue:5471653867 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1116). Originally posted by [anakatt](https://github.com/anakatt) on 2026-11-24T11:56:23Z. --- I validate the complete DXBC signature table before allocating from its declared element count. Previously, a truncated final element could be accepted, and an oversized count reached allocation before the parser checked the table bounds. ## What is in it - Checked table-size arithmetic and a bounds check before `Vec::with_capacity`. - Regression coverage for all six supported signature tags: truncated tables, oversized counts and offsets, and valid empty tables. ## Tested I ran the tests on Windows 11 Pro ARM64 10.0.26100.1742 in UTM (4 GiB RAM, virtual `virt-10.0` CPU, Red Hat VirtIO GPU DOD), using Rust 1.100.0 `x86_64-pc-windows-msvc` and Visual Studio 2022 Build Tools. The guest used a source archive of main `47efa2ecea0a12934719ae69b81930cf02a4b1c3` plus the source changes committed as `24fd09fcfc29a323ab47770ecf132a05b46a63eb`. - Before the fix, `cargo test --locked -p xcl --lib gpu::dxbc::tests::rejects_signature_tables_outside_the_part -- --exact`: **0 passed, 1 failed, 0 ignored**, 719 filtered out. The truncated signature returned `Some` instead of `None`. - After the fix, `cargo test --locked -p xcl --lib gpu::dxbc -- --test-threads=4`: **3 passed, 0 failed, 0 ignored**, 717 filtered out; no `SKIPPED` output. ## Not tested I have not run the full workspace suite, native x64 Windows hardware, D3D12 GPU execution, or a real game title. The VM's display adapter is not D3D12 GPU coverage. ## Regression run Not run. This remains a draft until both required real-title `xcl-smoke` blocks are available: one from main and one from this PR's clean head, using the same title and duration. The focused tests above do not replace those runs. ## AI use I used omp (`openai-codex/gpt-6-astra`) to investigate, implement the fix and regression, run the Windows tests, and prepare this PR.
eizispark commented 2026-11-24 14:06:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by eizispark on 2026-11-24T13:27:05Z.


Hardware test report — commit 24fd09f

Verified clean merge with main (47efa2e) on 24fd09fcfc29a323ab47770ecf132a05b46a63eb: pass.

Tested

  • Hardware: AMD Radeon RX 9070 XT (RDNA4, driver 32.0.32015.16001), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11, rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profile
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 742 passed, 0 failed, 41 ignored (GPU tests skipped on this adapter: none), including gpu::dxbc::tests::rejects_signature_tables_outside_the_part and all 3 gpu::dxbc::tests

Regression run
main (47efa2e):

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1677 (PresentX 1677)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14853 MB

PR (24fd09f):

xcl-smoke v1
commit: 24fd09fcfc29a323ab47770ecf132a05b46a63eb
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1676 (PresentX 1677)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14861 MB

Not tested

  • wave32-only GPUs (NVIDIA / Intel); retail run under XCL_D3D12_DEBUG=1; gameplay past the menus

AI use: Antigravity (Google DeepMind), Gemini (exact version string not exposed in runtime environment) — ran the workspace test suite and 60 s retail smoke check on the hardware above and formatted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7132847353 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1116#issuecomment-7132847353). Originally posted by [eizispark](https://github.com/eizispark) on 2026-11-24T13:27:05Z. --- ### Hardware test report — commit `24fd09f` Verified clean merge with `main` (`47efa2e`) on `24fd09fcfc29a323ab47770ecf132a05b46a63eb`: **pass**. **Tested** - Hardware: AMD Radeon RX 9070 XT (RDNA4, driver 32.0.32015.16001), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11, `rustc 1.100.0 (0ef1bc386 2026-11-09)`, release + test profile - `cargo test --workspace --no-fail-fast -- --test-threads=4`: `742 passed, 0 failed, 41 ignored` (GPU tests skipped on this adapter: `none`), including `gpu::dxbc::tests::rejects_signature_tables_outside_the_part` and all 3 `gpu::dxbc::tests` **Regression run** `main` (`47efa2e`): ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: AMD Radeon RX 9070 XT title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1677 (PresentX 1677) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14853 MB ``` PR (`24fd09f`): ``` xcl-smoke v1 commit: 24fd09fcfc29a323ab47770ecf132a05b46a63eb gpu: AMD Radeon RX 9070 XT title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1676 (PresentX 1677) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14861 MB ``` **Not tested** - wave32-only GPUs (NVIDIA / Intel); retail run under `XCL_D3D12_DEBUG=1`; gameplay past the menus **AI use**: Antigravity (Google DeepMind), Gemini (exact version string not exposed in runtime environment) — ran the workspace test suite and 60 s retail smoke check on the hardware above and formatted this report.
raylitebull commented 2026-11-25 02:08:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T01:13:23Z.


Diff audit passed (dxbc.rs::signature bounds-checks first + count * stride via checked_add/checked_mul and d.get(first..table_end)? before Vec::with_capacity), Build and test is green, and AMD RX 9070 XT verified 24fd09f.

Remaining before merge:

  1. Include the matched xcl-smoke pair in the PR description so the PR description check turns green.
  2. One independent NVIDIA check.
<!-- greyfinch-sync:ivall/xcl:comment:7149329168 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1116#issuecomment-7149329168). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T01:13:23Z. --- Diff audit passed (`dxbc.rs::signature` bounds-checks `first + count * stride` via `checked_add`/`checked_mul` and `d.get(first..table_end)?` before `Vec::with_capacity`), `Build and test` is green, and AMD RX 9070 XT verified `24fd09f`. **Remaining before merge:** 1. Include the matched `xcl-smoke` pair in the PR description so the `PR description` check turns green. 2. One independent **NVIDIA** check.
DavidM1911 commented 2026-11-25 09:08:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T08:16:00Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7156814689 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1116#issuecomment-7156814689). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T08:16:00Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
thehollowedone commented 2026-11-25 11:09:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-25T10:43:09Z.


Independent NVIDIA check on 24fd09f. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, DXC 1.8.2502.11.

cargo build --workspace --offline --locked -j 4 passed. cargo test --workspace --offline --locked --no-fail-fast -j 4 -- --nocapture --test-threads=4 ended with 742 passed, 0 failed, 41 ignored, with two wave64 runtime skips in Cargo’s pass count.

A scratch check parsed valid compiler-generated legacy DXBC ISGN/OSGN and DXIL ISG1/OSG1 vertex and pixel signatures. It checked both float and unsigned-integer stage inputs. An input layout built from the parsed DXIL vertex signature drew 64 of 64 expected pixels on native D3D12. The focused cargo test --offline --locked -j 4 -p xcl --lib local_valid_dxbc_signatures_link_and_draw_on_d3d12 -- --nocapture --test-threads=1 passed 1 of 1 without skips. Legacy DXBC coverage was parser-only. The existing matched AMD smoke pair is separate from this synthetic run.

AI use: Codex (GPT-6, exact variant unspecified) wrote the scratch fixture, ran the tests and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7160079788 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1116#issuecomment-7160079788). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-25T10:43:09Z. --- Independent NVIDIA check on [24fd09f](https://github.com/xcl-dev/xcl/commit/24fd09fcfc29a323ab47770ecf132a05b46a63eb). Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, DXC 1.8.2502.11. `cargo build --workspace --offline --locked -j 4` passed. `cargo test --workspace --offline --locked --no-fail-fast -j 4 -- --nocapture --test-threads=4` ended with **742 passed, 0 failed, 41 ignored**, with two wave64 runtime skips in Cargo’s pass count. A scratch check parsed valid compiler-generated legacy DXBC `ISGN`/`OSGN` and DXIL `ISG1`/`OSG1` vertex and pixel signatures. It checked both float and unsigned-integer stage inputs. An input layout built from the parsed DXIL vertex signature drew 64 of 64 expected pixels on native D3D12. The focused `cargo test --offline --locked -j 4 -p xcl --lib local_valid_dxbc_signatures_link_and_draw_on_d3d12 -- --nocapture --test-threads=1` passed 1 of 1 without skips. Legacy DXBC coverage was parser-only. The existing [matched AMD smoke pair](https://github.com/xcl-dev/xcl/pull/1116#issuecomment-7132847353) is separate from this synthetic run. AI use: Codex (GPT-6, exact variant unspecified) wrote the scratch fixture, ran the tests and drafted this report.
github-actions[bot] commented 2026-11-29 20:44:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:44:13Z.


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:7262317196 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1116#issuecomment-7262317196). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T20:44:13Z. --- 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 04:51:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:51:57Z.


Triage (#1607) – head 24fd09f

#1499 made the same check in dxbc.rs::signature (first + count * size within the part before Vec::with_capacity); it was closed without merging, and main does not have the check. #1499's extra checked_adds in rd32 / psv cannot overflow on x64 from u32 fields.
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:7301181621 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1116#issuecomment-7301181621). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:51:57Z. --- **Triage (#1607)** – head 24fd09f #1499 made the same check in `dxbc.rs::signature` (`first + count * size` within the part before `Vec::with_capacity`); it was closed without merging, and main does not have the check. #1499's extra `checked_add`s in `rd32` / `psv` cannot overflow on x64 from u32 fields. 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.
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/1116:upstream-pr/1116'
git switch 'upstream-pr/1116'

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/1116'
git switch 'upstream-pr/1116'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1116'
git switch 'upstream-pr/1116'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1116'
git switch 'main'
git merge --squash 'upstream-pr/1116'
git switch 'main'
git merge --ff-only 'upstream-pr/1116'
git switch 'main'
git merge 'upstream-pr/1116'
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!1107
No description provided.