draw.rs rectangle-list fallback: u32 first + count wraps before the bounds check; SizeInBytes can truncate #223
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX#223
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?
@kekonn on GitHub · 2026-11-26 11:59 UTC · original
crates/victory-gpu/src/draw.rs:3805:|| u64::from(first + count) * stride > u64::from(v.size)adds the two values inu32before widening. Release builds (anddiag, which inherits them) don't check for overflow, so the sum wraps and the bounds check can pass. Further down,SizeInBytes: (rects * 6 * stride) as u32(~3836) can truncate.The damage is limited:
shadow::find(from, rects*3*stride)(3806) still requires a registered title buffer covering the whole range. This is hardening, not a crash anyone has seen.When: only the CPU fallback for RECTANGLES pipelines that did not get the rectangle geometry stage. It also needs a direct draw with
first + count >= 2^32, or a range of 4 GiB or more.Proposed fix (~4 lines)
Compute
(u64::from(first) + u64::from(count)) * stride, and buildSizeInByteswithu32::try_from(…), returningfalseon overflow.Upstream: no open PR changes
rectangles(). #53 adds a diagnostics hunk just above it.Status: a fix is being prepared in kekonn/VIctory-7900XTX on branch
claude/gifted-clarke-uxuqw8.Generated by Claude Code