HLE: validate null pointer in ApuIsVirtualAddressValid and overflow in ApuAlloc #528
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/528"
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-24T04:28:19Z.
Problem
In
crates/victory-hle/src/modules/audio.rs:ApuIsVirtualAddressValiddoes not short-circuit on null pointers before callingheap_map(0).ApuMapVirtualAddressdoes not check for null input.ApuAllocdoes not check for arithmetic overflow when validatingsizeandalign.Fix
falseifptr.is_null()inApuIsVirtualAddressValid.0ifptr.is_null()inApuMapVirtualAddress.size.checked_add(align).is_none()inApuAlloc.No game files used.
Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T04:51:30Z.
Review: APPROVED
Verified on Windows 11:
Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T04:51:23Z.
### Technical Verification & Implementation Details
Context & Root Cause
In
crates/victory-hle/src/modules/audio.rs:ApuIsVirtualAddressValidcalledheap_map(0)when passed null pointers instead of short-circuiting tofalse.ApuMapVirtualAddressdid not check for null pointer input.ApuAllocperformed unbounded arithmeticsize + alignwithout overflow checks.Changes & Diff
0(false) immediately ifptr.is_null()inApuIsVirtualAddressValid.0immediately ifptr.is_null()inApuMapVirtualAddress.size.checked_add(align).is_none()inApuAlloc.Git Log Line & Verification
ext b1539b7 HLE: validate null pointer in ApuIsVirtualAddressValid and overflow in ApuAlloc crates/victory-hle/src/modules/audio.rs | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)cargo xtask policy(Rule #1 compliance, zero game assets).rustfmt --edition 2024.Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T06:15:01Z.
Thank you @LAKSHYA-cmd-tech for testing and verifying on Windows 11! Glad all 87 tests and asset policy passed cleanly.
Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T06:23:41Z.
### Ready for Merge
Verified and approved on Windows 11 by @LAKSHYA-cmd-tech (all unit tests passing, zero Clippy warnings, asset policy passing).
@Marvisak: Ready for maintainer review and merge when you have time!
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T11:56:38Z.
Review: APPROVED
Tested
b1539b7on Windows 11, RTX 5070, MSVC:cargo test -p victory-hle87 passed, including the new null and overflow assertions. Clippy's 1 warning is the existingfield_reassign_with_defaultat xmem.rs:747.ApuIsVirtualAddressValidandApuMapVirtualAddressrun before any heap lookup, andsize.checked_add(align)rejects anApuAllocwhose aligned size would wrap.audio.rsare formatting only. Fine, though a separate commit would keep the functional diff easier to read.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T12:38:21Z.
Thank you @mercuryVM for testing and approving!
Acknowledged on keeping functional diffs strictly separated from formatting hunks—I'll ensure future HLE PRs isolate formatting into dedicated commits for maximum review clarity.
Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T13:01:50Z.
@Marvisak: PR #528 has approvals from both @LAKSHYA-cmd-tech and @mercuryVM (verified clean on Windows 11 MSVC with all 87 HLE tests passing and Rule #1 compliant). Whenever you have a moment, this is ready to merge!
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:03:49Z.
Automated triage for the maintainers. Closing because it does not change behaviour the project needs (formatting, guards for cases that cannot occur, or notes and translations that cannot be kept current).
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed