HLE: validate pointers in XGameUi text entry result and size getters #519
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/519"
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:25:29Z.
Problem
In
crates/victory-hle/src/modules/xgameui.rs:text_entry_sizedoes not check ifoutis null before querying result size, risking an invalid argument return code or write failure.text_entry_resultdoes not check whetherbufferis null whensize > 0.Fix
xasync::E_INVALIDARGifout.is_null()intext_entry_size.xasync::E_INVALIDARGifsize > 0 && buffer.is_null()intext_entry_result.No game files used.
Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T04:50:58Z.
### Technical Verification & Implementation Details
Context & Root Cause
In
crates/victory-hle/src/modules/xgameui.rs,XGameUiShowTextEntryResultSizeandXGameUiShowTextEntryResultdereferenced out-pointers (result_text_byte_count,result_text) without validating whether the caller passed a null pointer, causing access violations when games query status or pass null buffers.Changes & Diff
E_INVALIDARG(0x80070057) if null.text_entry_result_size_rejects_nullandtext_entry_result_rejects_null.Git Log Line & Verification
ext 4ab8bca HLE: validate pointers in XGameUi text entry result and size getters crates/victory-hle/src/modules/xgameui.rs | 62 +++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 11 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:24:03Z.
### Call for Testing & Maintainer Review
Community members testing game initialization or HLE modules on Windows 10/11: verification and feedback on this PR is warmly welcome!
cargo xtask policypassing).@Marvisak: Ready for maintainer review and merge when convenient!
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T09:31:10Z.
Review: APPROVED
Tested
4ab8bcaon Windows 11, RTX 5070, MSVC: the workspace passes (195 outsidevictory-shader, which I ran separately).The two guards are right: a null
outon the size query, and a nullbufferwithsize > 0on the result. Both returnE_INVALIDARGbefore touching the async block, so a bad call doesn't consume the result. The new assertions sit before the successful read in the test, which confirms that.Nit: most of the diff is rustfmt reflow of unrelated lines (
dialogmodule, test asserts). It's harmless, but it makes the real 6-line change harder to spot and more likely to conflict.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T11:27:32Z.
Thank you @mercuryVM for testing and approving! Acknowledged on the rustfmt reflow nit—will keep diffs strictly minimal on future HLE PRs.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:03:37Z.
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).
No value: the null-output check repeats what put() already returns, the other check only swaps one error code for another without evidence, and the rest reformats about 40 unrelated lines.
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