xmem: use saturating_add for view end bounds in aliases #2411
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?
Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-25T13:07:33Z.
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.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:47:20Z.
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