D3D12.X: fix null device allocation info null-deref, overflow, and RowPitch truncation #1631
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1631
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1631"
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?
@b3IKK on GitHub · 2026-11-24 18:25 UTC · original
b3IKK:d3d12x/null-alloc-and-footprints-bounds→main· +69 −20 · 1 files · 1 commits · openFixes three bugs in
crates/xcl/src/hle/d3d12x/null.rs:Device_GetResourceAllocationInfocomputeddescs.add(i * 56)even whendescswas null, dereferencing0x38oni = 1whenn >= 2(access violation).approx_size,new_resource,Device_GetResourceAllocationInfo, andDevice_GetCopyableFootprintsused unchecked arithmetic and aligned pointer dereferences on raw*const u8/*mut u8buffers, overflowing on large dimensions/widths and aborting on unaligned descriptors.Device_GetCopyableFootprintsmultiplied buffer widths by4and truncated((width * 4 + 255) & !255) as u32, turning a 1 GiB buffer'sRowPitchinto0.This guards
descs.is_null(), uses saturating arithmetic andread_unaligned/write_unaligned, treatsBUFFER(dim == 1) as 1 bpp, and clampsRowPitchtou32::MAX & !255.What is in it
crates/xcl/src/hle/d3d12x/null.rs: guard nulldescs, use saturating math and unaligned reads/writes inapprox_size,new_resource,Device_GetResourceAllocationInfo, andDevice_GetCopyableFootprints; clampRowPitchand handle 1-bpp buffers; add unit testnull_alloc_info_and_footprints_guard_null_and_overflow.Since the last push: rebased onto
main06c9f55; the only conflict wasstruct_returning_methods_take_the_buffer_first_or_second, a testmainhad added at the same place, and both are kept.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): 1266 passed, 0 failed, 46 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses,no heap windows, andcannot disable the driver cache (Windows Developer Mode is required))cargo test -p xcl --lib hle::d3d12x::null::tests: 4 passed, 0 failedRegression run
main (
426a5a7, clean tree, no local changes):PR (
ef0cb29, clean tree, no local changes):(The main block is
426a5a7, an ancestor of the currentmain, from the same machine and data folder.)Not tested
AI use
main06c9f55, resolved the conflicts, ran the suite and thescripts/smoke.ps1pair at the head above.@Belox17 on GitHub · 2026-11-24 20:03 UTC · original
Test report for
30418877on NVIDIA (RTX 3060 Ti): passes, and without the fix the test crashes with an access violationTested
30418877as is (base9e3831e), clean tree.null_alloc_info_and_footprints_guard_null_and_overflow) withcargo test -p xcl --lib <name>: 1 passed.cargo test --workspace -- --test-threads=4on the head: 777 passed, 0 failed, 41 ignored; its base9e3831eon the same machine: 776 passed, 0 failed, 41 ignored. SKIPPED on both:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).mainc160d86e(clean merge): 859 passed, 0 failed, 42 ignored;mainalone: 858 passed, 0 failed, 42 ignored, the same three SKIPPED as above.hle/d3d12x/null.rsreverted (test kept), the test process ends with0xc0000005(STATUS_ACCESS_VIOLATION).Not tested
AI use: Claude Code (Claude Opus 5.5) ran the commands on this machine and wrote this report from those runs.
@DavidM1911 on GitHub · 2026-11-24 20:46 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
@DavidM1911 on GitHub · 2026-11-26 05:58 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.