xmem: check n * PAGE and base + len overflow in XMemMapPhysicalPages (#224) #247
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/247"
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 avatarmanz/VIctory-7900XTX. Originally posted by ending3729 on 2026-11-26T12:38:44Z.
Fixes #224.
What changed
crates/victory-hle/src/modules/xmem.rs: inXMemMapPhysicalPages, checkn.checked_mul(PAGE)andbase.checked_add(len)beforestd::slice::from_raw_parts(pages, n)andunmap, returning null on overflow.crates/victory-hle/src/modules/xmem.rs: inunmap, checkbase.checked_add(len)soendcannot wrap.modules::xmem::tests::map_physical_pages_rejects_overflowing_count_and_end(verified failing before the fix and passing after).Tested
cargo test -p victory-hle --locked: 156 passed, 0 failed, 2 ignored;no_dll_planting: 1 passed, 0 failedcargo test -p xtask --locked: 9 passed, 0 failedcargo clippy -p victory-hle --all-targets --locked --no-deps -- -D warnings: 0 warningsAI use
Imported from avatarmanz/VIctory-7900XTX. Originally posted by lerapeurdu62280-debug on 2026-11-26T14:16:04Z.
Read the diff. checked_mul/checked_add before from_raw_parts and in unmap close a real wrap on title-supplied n/address, and the test covers both the count and the end overflow.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.