Shaders/validator+gfx10: guard null IDxcBlob slice UB, check GetStatus HR, and fix ds_wrap/global_addtid fields #630
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!630
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-630"
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?
@AscilCH on GitHub · 2026-11-25 03:26 UTC · original
AscilCH:fix/shader-validator-null-blob-and-gfx10-fields→main· +97 −4 · 2 files · 1 commits · openProblem
Two sets of bugs in
victory-shader:GetStatusfailure inemit/validator.rs:std::slice::from_raw_parts(ptr(errors), len(errors))passed a rawIDxcBlob::GetBufferPointer()directly toslice::from_raw_parts, which is UB (and panics under Rust debugub_checks) when an emptyIDxcBlobreturns(null, 0).HRESULTreturned byIDxcOperationResult::GetStatuswas discarded; ifGetStatusitself failed,statusremained0andvalidate()falsely returnedOk(()).gfx10/fields.rs:ds_wrap_rtn_b32 vdst, vaddr, vdata0, vdata1takes two data VGPRs, but"wrap"was omitted from the 2-data-operand check (fields.rs:303), silently droppingvdata1fromFields::Ds::data, disassembly, andir::buildregister reads.global_load_dword_addtidandglobal_store_dword_addtidcompute addresses fromsaddr + offset + lane_id * 4and take novaddrVGPR, yetEncoding::Global(fields.rs:392) unconditionally decodedaddr: Some(v0), fabricating a spuriousv0read inir::build.Fix
get_status(result, &mut status)incrates/victory-shader/src/emit/validator.rs, releasingresultand returningErron failure, and borrow error blob bytes throughblob_bytes()guardingp.is_null() || n == 0.name.contains("wrap")in the 2-data-operandEncoding::Dscheck and guardEncoding::Globaladdrwith!name.contains("addtid")incrates/victory-shader/src/gfx10/fields.rs.blob_bytes_handles_null_or_empty_without_ubandds_wrap_rtn_decodes_both_data_operands_and_global_addtid_has_no_vaddr.Verification
cargo test -p victory-shader --locked emit::validator::tests: 1 passed, 0 failedcargo test -p victory-shader --locked gfx10::: 13 passed, 0 failedcargo xtask policy: 169 files okcargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean(AI-assisted; synthetic unit tests only, no game data.)
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.