xmem: use saturating_add for view end bounds in aliases #2413
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#2413
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?
@pushkarreddyy on GitHub · 2026-11-25 13:07 UTC · original
Summary
In
crates/victory-hle/src/modules/xmem.rs(aliases),endis computed withat.saturating_add(len), but the view range checks on lines 412 and 417 compute*base + sizeandbase + sizewith unchecked addition, which can overflow/panic if a view'sbase + sizereachesusize::MAX.Expected
Use
saturating_addforbase + sizeinaliasesto matchat.saturating_add(len).Claiming this issue and opening a PR with unit tests shortly.
@Marvisak on GitHub · 2026-11-25 15:47 UTC · original
Automated triage for the maintainers.
Read against main (
da82e44): incrates/victory-hle/src/modules/xmem.rs,physical.viewsonly gets an entry afterMapViewOfFile3has mappedlenbytes atbaseand the result was checked (end of the view-mapping function,physical.views.insert(base, (len, slice))). So every(base, size)thataliasesreads is a live range of the host process's user address space, andbase + sizestays far belowusize::MAX.at + lencomes from the caller, which is why only that sum saturates. The overflow described here cannot happen; switching tosaturating_add(open PR #2421) would only be defensive.Generated by Claude Code