GPU: fix 8 overflow, lookup, and snapshot bugs in shadow.rs with regression tests #906
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#906
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@geiyiliyabumo on GitHub · 2026-11-24 13:52 UTC · original
Summary
Fixes 8 real overflow/underflow, buffer-lookup, and snapshot-consistency bugs in
crates/victory-gpu/src/shadow.rs(previously 0 unit tests) and adds 8 synthetic regression tests proving each invariant.Because external PR creation is currently restricted (
collaborators_only), the CI-green branch is ready on my fork for cherry-pick / review:geiyiliyabumo/VIctory@test/gpu-shadow-testsgeiyiliyabumo/VIctory@c1dd5b1(based onmainffe310e)Bugs Fixed (
crates/victory-gpu/src/shadow.rs)register:start + lenu64overflow ->checked_add(reject overflowing registrations).loose: windownext_multiple_ofoverflow ->checked_next_multiple_of+checked_sub.find:.take(64)could stop before reaching an earlier covering buffer -> unbounded start-descending scan.find: equal-start buffers could return a larger covering buffer instead of the tightest -> choose smallestendamong equal starts.refresh:start + len - addressunderflow whenaddressis past end -> useself.left(address).inside/writing/copy_back/update:address + lenusizeoverflow ->saturating_add.writing: newly declared gap retained stale baseline -> re-snapshot declared range and dedupe viapending.copy_back: overlapping copy-backs could replay an earlier CPU edit -> refresh snapshot after copy-back.Verification (Windows 11 x64 MSVC, AMD Radeon RX 9060 XT RDNA4 + WARP)
rustfmt --edition 2024 --check crates/victory-gpu/src/shadow.rs: PASScargo xtask policy: PASS (154 files ok)cargo clippy -p victory-gpu --all-targets --locked -- -D warnings(default +--features diagnostics): PASS (0 warnings)cargo test -p victory-gpu --features diagnostics --locked -- shadow::(live RX 9060 XT): 8 passed, 0 failedVICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --locked -- shadow::: 8 passed, 0 failedAI-assisted; synthetic tests only, no game files.
@DenRakEiw on GitHub · 2026-11-24 14:15 UTC · original
Independent verification of
c1dd5b1(geiyiliyabumo/VIctory@test/gpu-shadow-tests, fast-forward onmainffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC) with NVIDIA GeForce RTX 5090 (Blackwell) and WARP:VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics -- shadow:: --nocapture: 8 passed, 0 failed (all 6shadow::warp_tests::*and bothshadow::tests::*executed and passed)cargo test -p victory-gpu --features diagnostics(RTX 5090): 61 passed, 0 failed, 1 ignored (note: the 6shadow::warp_tests::*skip unlessVICTORY_D3D12_WARPis set)cargo clippy -p victory-gpu --features diagnostics --all-targets: 0 warningscargo xtask policy: okAI-assisted (Gemini 4 Neon).
@Marvisak on GitHub · 2026-11-25 06:59 UTC · original
Automated triage for the maintainers.
The pull request for this branch, #1186, was already reviewed and closed:
crates/victory-gpu/src/shadow.rshas largely been replaced onmainsinceffe310e, and most of the eight guards are for cases that cannot occur. The two changes that still matter are in focused open PRs: #402 (finding a buffer past many smaller ones) and #261 (copy-back keeping newer title bytes). Please follow those; if something here is not covered by them, a small PR against currentmainwith a failing test is the way to raise it.Generated by Claude Code