D3D12.X: pass a NULL-ppv CreateDescriptorHeap validation call through (#2401) #2556
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!2556
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2556/head"
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?
@kotekompotek on GitHub · 2026-11-25 22:49 UTC · original
kotekompotek:fix/desc-heap-null-ppv→main· +70 −1 · 1 files · 1 commits · closed without mergingFixes #2401.
In D3D12,
ID3D12Device::CreateDescriptorHeapwithppvHeap == NULLis the documented parameter-validation call – the PC answersS_FALSE(1, which satisfieshr >= 0) and writes nothing.dev_create_descriptor_heap_xchecked onlyhr >= 0and then read*ppvto register the heap's console bookkeeping: a NULLppv(or a*ppvthe PC left NULL) is a null-pointer read the moment the call "succeeds".What is in it
hle/d3d12x/real.rs: the heap-registration block now runs underhr >= 0 && !ppv.is_null() && !(*ppv).is_null()– the same guard thecreator!macro and the other_xmethods already apply. The HRESULT passes through untouched either way.create_descriptor_heap_x_tests: a fake adopted device (CLASSES entry + ext vtable stub, asadopt()records them) whose PC-sideCreateDescriptorHeapanswersS_FALSE. Callingdev_create_descriptor_heap_xwithppv == NULL, and with an out pointer the PC left NULL, returnsS_FALSEinstead of dereferencing it; the test aborts on the null read when the guard is reverted (checked).Tested
cargo test --workspace --no-fail-fast -- --test-threads=4on the head commit: 1421 passed, 3 failed, 46 ignored (SKIPPED GPU tests: 355 – this adapter has no SM 6.6 / mesh shaders)gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark(driver refuses a sparse heap op, HRESULT 0x80070057),stale_blob_cannot_bypass_the_offline_pipeline_capandsplit_compute_program_prebuilds_and_caches_chain_pieces(both build/dispatch cs_6_6, which this SM 6.5 adapter cannot run; the latter is a new upstream test with no capability gate)a_null_ppv_validation_call_passes_the_pc_answer_throughaborts with a null-pointer dereference when the fix is reverted (checked by restoringif hr >= 0)Regression run
main:
PR:
Not tested
-Seconds1-8 the log showsunhandled exception 0x80000003thenprocess ends with status 0x80000003). The blocks above end it throughXCL_RUN_SECONDS=0before that point – they cover host boot, game loading and shutdown, no frames, no shaders.CreateDescriptorHeapwithppv == NULLthrough the console interface: the validation call is exercised by the unit test's fake device, not observed from a real game.AI use
@DavidM1911 on GitHub · 2026-11-25 23:19 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 26 ignored.Thanks!
— Devin
@xpatfussy69x on GitHub · 2026-11-26 00:02 UTC · original
Test run on exact head
43d1ebb(43d1ebb64ccbcb4c5235c7f13089d9de2af04ad6, on its base6d12f58), clean tree.Tested
cargo test --workspace -- --test-threads=4: 1424 passed, 0 failed, 46 ignoredV_MUL_F16/V_PK_MUL_F16/V_CVT_F16_F32(onmaintoo)cargo test -p xcl --lib a_null_ppv_validation_call: 1 passed, 0 faileda_null_ppv_validation_call_passes_the_pc_answer_through: okRegression run (60 s, default settings, a retail title)
main:
this PR:
No crash or device removal; frames 105 % of
main's, peak commit 100 %. Themainrun is on currentmain(08db802), newer than this PR's base.Not tested
main(tested on its own base; it merges into08db802without conflicts)AI use
@Prime1997 on GitHub · 2026-11-26 00:19 UTC · original
Closing as a duplicate of #2444, which was opened earlier for the same issue (#2401). Both make the same change in
dev_create_descriptor_heap_x: the registration guard becomeshr >= 0 && !ppv.is_null() && !(*ppv).is_null(), so the null-ppv validation call returns S_FALSE without reading*ppv. Only the tests differ. The unit test for an out pointer left NULL could be offered on #2444 if wanted.Compared at heads
43d1ebb6(this PR) ande5e55281(#2444) against main08db802. Reviewed with Claude Code (Claude Opus 5.5); I checked the comparison before closing.Pull request closed