Shaders: bounds-check DXBC signature table before Vec::with_capacity #1489
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1499"
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?
Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T16:59:00Z.
dxbc::signature()calledVec::with_capacity(count)with the rawu32element count from anISG1/OSG1/ISGN/OSGNpart before verifying thatfirst + count * size <= d.len(). A small malformed signature part claimingcount = u32::MAXaborted the process on an unbounded ~206 GiB allocation instead of returningNone.This validates
first + count * size <= d.len()with checked arithmetic before allocating, and uses checked additions inrd32andpsv.What is in it
crates/xcl/src/gpu/dxbc.rs: bounds-check the signature table beforeVec::with_capacity(count), use checked additions inrd32andpsv, and add unit testtruncated_or_oversized_signature_returns_none_without_allocating.Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 771 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2no wave64—gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware)cargo test -p xcl --lib gpu::dxbc::tests: 3 passed, 0 failedRegression run
main:
PR:
Not tested
AI use
gpu/dxbc.rs, wrote the fix and unit test, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T18:53:38Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by Belox17 on 2026-11-24T20:02:56Z.
Test report for
8afc955don NVIDIA (RTX 3060 Ti): passes, and without the fix the test aborts on the allocation it guardsTested
8afc955das is (baseb7aa9f3), clean tree.truncated_or_oversized_signature_returns_none_without_allocating) withcargo test -p xcl --lib <name>: 1 passed.cargo test --workspace -- --test-threads=4on the head: 771 passed, 0 failed, 41 ignored; its baseb7aa9f3on the same machine: 770 passed, 0 failed, 41 ignored. SKIPPED on both:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64).mainc160d86e(clean merge): 859 passed, 0 failed, 42 ignored;mainalone: 858 passed, 0 failed, 42 ignored, the same three SKIPPED as above.gpu/dxbc.rsreverted (test kept), the test process aborts withmemory allocation of 206158430160 bytes failed.Not tested
AI use: Claude Code (Claude Opus 5.5) ran the commands on this machine and wrote this report from those runs.
Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-25T00:04:00Z.
On #1607's group D61: #1116 came first and makes the same change in
signature. I am leaving this one open for now only because #1116'sPR descriptioncheck currently fails, so it cannot be merged as it stands, while this one passes and was run in batches B2 / B13. If #1116's check goes green I will close this in its favour; the two extrachecked_addcalls here (rd32,psv) can then be a follow-up. AI use: OpenCode, Claude Fable 5.2.Imported from ivall/xcl. Originally posted by CalvyPZ on 2026-11-25T22:45:42Z.
This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.
Pull request closed