GPU: guard OMSetRenderTargets handle expansion on empty, null, or oversized calls #1428
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1428
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1428"
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?
@fuzeofficlal on GitHub · 2026-11-24 17:57 UTC · original
fuzeofficlal:fix/om-set-render-targets-handles-796→main· +104 −8 · 1 files · 1 commits · openFixes #796.
Summary
state::target_handlesincrates/victory-gpu/src/list.rssoOMSetRenderTargets(state::targets) expands handles into a stack-allocated[u64; D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT]array:count == 0orhandlesis null soOMSetRenderTargets(0, p, TRUE, &dsv)never dereferences a stale or uninitializedpRenderTargetDescriptorspointer.counttoD3D12_SIMULTANEOUS_RENDER_TARGET_COUNT(8).Verification
list::tests::target_handles_guards_empty_null_and_clamps_to_eight: coverscount == 0with a dangling pointer, null pointer, single-range expansion, array expansion, and clamping to 8.list::tests::om_set_render_targets_zero_count_does_not_read_handles: calls vtable slot0x190(OMSetRenderTargets) withcount == 0and aPAGE_NOACCESSpointer (one_range = 1with&dsvandone_range = 0with null DSV).cargo clippy -p victory-gpu --tests --locked -- -D warningsandcargo xtask policy: passed.@Marvisak on GitHub · 2026-11-25 01:27 UTC · original · edited 2026-11-25 11:20 UTC
Automated triage for the maintainers.
Merge candidate.
state::targetsincrates/victory-gpu/src/list.rsnow goes throughstate::target_handles. It returns no handles whencount == 0orhandlesis null, soOMSetRenderTargets(0, p, TRUE, &dsv)no longer reads*p, which is the bug in #796. It also capscountatD3D12_SIMULTANEOUS_RENDER_TARGET_COUNTand uses a stack array in place of aVec. The array path still goes throughitems, as before. The tests are short:target_handlesassertions for the empty, null, single-range, array and clamp cases.om_set_render_targets_zero_count_does_not_read_handles, which calls vtable slot0x190(state::targets, entry 50 of the list vtable) withcount == 0and aPAGE_NOACCESSpointer. That test would fault onmain.CI is passing (
check), and the PR merges cleanly.On your reply: thanks, the head changed to
ec57a6eand it does what the last triage asked. The rendering test is gone, the overflow and zero-base guards are dropped, and the crash is covered directly.Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-25 09:44 UTC · original
Updated in
ec57a6e4per triage feedback:D3DCompile/MRT rendering test and replaced the vtable coverage withom_set_render_targets_zero_count_does_not_read_handles, which callsOMSetRenderTargets(0x190) withcount == 0against aPAGE_NOACCESSpage (one_range = 1with&dsvandone_range = 0with null DSV), alongside the puretarget_handlesunit checks.u64::MAXoverflow and zero-base checks, keeping only thecount == 0/ null early return and theD3D12_SIMULTANEOUS_RENDER_TARGET_COUNT(8) clamp.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.