DXC: an empty blob's null buffer is an empty slice, not UB (#2413) #2580
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!2580
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2580"
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 23:53 UTC · original
kotekompotek:fix/dxc-empty-blob→main· +22 −2 · 1 files · 1 commits · closed without mergingFixes #2413 (the empty-blob half; the candidate-load handle leak is a separate PR).
DXC results are read out of
IDxcBlobs withslice::from_raw_parts(ptr, len)(output(), shared bycompile_whole,compile_linkedanddisassemble). An emptyIDxcBlobreports a nullGetBufferPointer, andfrom_raw_partson a null pointer is UB even at length 0 – debug builds abort on the non-null precondition, so an empty error buffer would panic inside the error-reporting path itself (and an empty result blob on the success path).What is in it
gpu/recomp/dxc.rs: ablob_bytes(ptr, len)helper maps a null pointer to an empty slice; both reads (theGetErrorBuffertext and theGetResultDXIL) go through it.blob_bytes_tests:a_null_blob_buffer_is_an_empty_slicecovers the null-pointer and ordinary-buffer cases. (The samefrom_raw_parts(blob…)shape exists in a few other files – mentioned, not changed: this PR is scoped to the DXC compile path the issue names.)Tested
cargo test --workspace --no-fail-fast -- --test-threads=4: 1421 passed, 3 failed, 46 ignored (SKIPPED GPU tests: 355 – this adapter has no SM 6.6 / mesh shaders); run onc7eb111, the same diff before the branch was rebased ontob49be183to resolve a collision with the new DXC linking code750e9d30:cargo test -p xcl --lib: 1303 passed, 3 failed, 27 ignored (4 timing-sensitive tests flaked under parallel release builds; all 4 passed in a targeted rerun)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)a_null_blob_buffer_is_an_empty_slicepasses; the pre-fix shape (from_raw_partson the raw pointer) cannot be exercised through it – the UB is on the DXC edge case itselfRegression run
main:
PR:
Not tested
XCL_RUN_SECONDS=0before that point – they cover host boot, game loading and shutdown, no frames, no shaders.blob_bytesunit level; DXC blobs cannot be stubbed without a COM double.AI use
blob_byteshelper, the unit test, the test suite, both smoke runs and this PR.@DavidM1911 on GitHub · 2026-11-26 00:08 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
@throny on GitHub · 2026-11-26 01:10 UTC · original
Two contributors checked independently and found that this PR makes the same change as #2441 (for #2413): #1607, group D123. They suggest keeping #2441. If you agree, closing this PR or joining the other one would save the maintainers a review. If the two differ in a way the checks missed, a note in #1607 helps.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
@kotekompotek on GitHub · 2026-11-26 08:42 UTC · original
Closing per the D123 dedupe in #1607 — this makes the same fix as #2441 (both return an empty slice for an empty blob's null buffer pointer instead of the UB
from_raw_parts). #2441's helper is the nicer shape anyway: it ties the slice lifetime to the&IDxcBlobborrow and also guards a zero size. One data point for whoever lands it: #2441 currently conflicts withmain, this head is mergeable and was verified on an RTX 3060 Ti — reopen if the other stalls.Pull request closed