GPU: rectangle draws check their bounds without 32-bit overflow #616
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!616
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-616"
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?
@itzzArshad on GitHub · 2026-11-24 05:42 UTC · original
itzzArshad:fix/gpu-rect-bounds-overflow→main· +68 −11 · 1 files · 2 commits · openThe rectangle-list bounds check added
first + countin 32 bits, so a draw whose first vertex and count together pass 2^32 wrapped to a small end, passed the check, and had the CPU expansion read far outside the vertex buffer at submission (title memory that may not be mapped), or panicked in debug builds. The check is now done in 64 bits with a checked multiply by the stride.The expanded draw's vertex count (
count / 3 * 6) and its vertex view size (rects * 6 * stride) also overflowed 32 bits silently; such draws are now dropped with a warning instead of running with a wrapped count.@geiyiliyabumo on GitHub · 2026-11-24 10:50 UTC · original
Independent verification & code review on Windows 11 Pro (build 26100) + AMD Radeon RX 9060 XT (RDNA4, driver
32.0.32029.2010, Rust1.98.1), merged ontomain(ffe310e):cargo xtask policy: PASS (154 files ok)cargo test -p victory-gpu --locked -- draw: 3/3 PASS (including underVICTORY_D3D12_DEBUG=1on RX 9060 XT and WARP)cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: FAIL after clean auto-merge ontomain(ffe310e)Findings
clippy::items-after-test-module): Althoughgit mergesucceeds without conflict againstffe310e, it leaves#[cfg(test)] mod tests(crates/victory-gpu/src/draw.rs:1226) ahead ofviewports,scissors,blend_factor, andstencil_ref(draw.rs:1256-1274), which failsclippy --all-targets -- -D warnings. Movingmod teststo the end ofdraw.rsresolves it.draw.rsrectangles):.map(|offset| v.address + offset)still uses uncheckedu64addition on the guestv.addresspointer; switching to.and_then(|offset| v.address.checked_add(offset))avoids debug-mode overflow panics on malformed high addresses.The core
expanded_verticesandrect_sourceoverflow logic and tests look solid otherwise.AI-assisted; synthetic tests only, no game files.
@MichaelSmithAI on GitHub · 2026-11-24 13:32 UTC · original
Melissa checked the accepted boundary through a rendered draw on RTX 4090 with Wine/vkd3d-proton 3.2. Head
e930351merged cleanly withffe310e. A guest rectangle-list draw used three vertices starting at vertex 3 in a 48-byte vertex view with an 8-byte stride. Its last vertex ended exactly at the end of the view. After expansion, all 64 pixels of the 8×8 render target read back red.All four rectangle-filtered tests passed on that integration, including both bounds tests, the fourth-corner test, and the new render readback. This checks that the revised bounds still admit a valid edge-aligned draw.
@Yaekai on GitHub · 2026-11-24 16:15 UTC · original
Independent test & review on Windows 11 + NVIDIA RTX 3070 (Rust 1.98.1) at head
e930351:cargo test -p victory-gpu --lib: 46 passed, 0 failed.cargo clippy -p victory-gpu -- -D warnings: 0 warnings.draw.rs+ new rectangle bounds unit tests: cleanly prevents 32-bit overflow in vertex/address calculations. Ready to merge!@Marvisak on GitHub · 2026-11-25 00:30 UTC · original
Automated triage for the maintainers.
Needs rebase. This PR does not merge cleanly into current
main(ac2525d). Conflicting files:crates/victory-gpu/src/draw.rs.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.