HLE: validate pointers in XGameUi text entry result and size getters #519

Closed
github-bot wants to merge 1 commit from gh-pr/519/head into gh-pr/519/base
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 04:25 UTC · original
pushkarreddyy:fix/xgameui-text-entry-null-checks → main · +51 −11 · 1 files · 1 commits · closed without merging

Problem

In crates/victory-hle/src/modules/xgameui.rs:

  • text_entry_size does not check if out is null before querying result size, risking an invalid argument return code or write failure.
  • text_entry_result does not check whether buffer is null when size > 0.

Fix

  • Return xasync::E_INVALIDARG if out.is_null() in text_entry_size.
  • Return xasync::E_INVALIDARG if size > 0 && buffer.is_null() in text_entry_result.
  • Added unit test coverage for null pointer validation.

No game files used.

**@⁠pushkarreddyy** on GitHub · 2026-11-24 04:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/519) `pushkarreddyy:fix/xgameui-text-entry-null-checks` → `main` · +51 −11 · 1 files · 1 commits · closed without merging ## Problem In `crates/victory-hle/src/modules/xgameui.rs`: - `text_entry_size` does not check if `out` is null before querying result size, risking an invalid argument return code or write failure. - `text_entry_result` does not check whether `buffer` is null when `size > 0`. ## Fix - Return `xasync::E_INVALIDARG` if `out.is_null()` in `text_entry_size`. - Return `xasync::E_INVALIDARG` if `size > 0 && buffer.is_null()` in `text_entry_result`. - Added unit test coverage for null pointer validation. No game files used.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:06:55 +00:00
github-bot closed this pull request 2026-11-26 04:06:55 +00:00
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 04:50 UTC · original

### Technical Verification & Implementation Details

Context & Root Cause

In crates/victory-hle/src/modules/xgameui.rs, XGameUiShowTextEntryResultSize and XGameUiShowTextEntryResult dereferenced 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

  • Validated pointers and returned E_INVALIDARG (0x80070057) if null.
  • Added unit tests text_entry_result_size_rejects_null and text_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(-)

  • Passes cargo xtask policy (Rule #1 compliance, zero game assets).
  • Formatted with rustfmt --edition 2024.
**@⁠pushkarreddyy** on GitHub · 2026-11-24 04:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/519#issuecomment-7122393732) ### Technical Verification & Implementation Details #### Context & Root Cause In `crates/victory-hle/src/modules/xgameui.rs`, `XGameUiShowTextEntryResultSize` and `XGameUiShowTextEntryResult` dereferenced 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 - Validated pointers and returned `E_INVALIDARG` (`0x80070057`) if null. - Added unit tests `text_entry_result_size_rejects_null` and `text_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(-) ` - Passes `cargo xtask policy` (Rule #1 compliance, zero game assets). - Formatted with `rustfmt --edition 2024`.
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 06:24 UTC · original

### 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!

  • Rule #1 asset policy compliant (cargo xtask policy passing).
  • Formatted with Rust 2024.

@⁠Marvisak: Ready for maintainer review and merge when convenient!

**@⁠pushkarreddyy** on GitHub · 2026-11-24 06:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/519#issuecomment-7123893551) ### 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! - Rule #1 asset policy compliant (`cargo xtask policy` passing). - Formatted with Rust 2024. @⁠Marvisak: Ready for maintainer review and merge when convenient!
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 11:27 UTC · original

Thank you @⁠mercuryVM for testing and approving! Acknowledged on the rustfmt reflow nit—will keep diffs strictly minimal on future HLE PRs.

**@⁠pushkarreddyy** on GitHub · 2026-11-24 11:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/519#issuecomment-7130123561) Thank you @⁠mercuryVM for testing and approving! Acknowledged on the rustfmt reflow nit—will keep diffs strictly minimal on future HLE PRs.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:03 UTC · original

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.

**@⁠Marvisak** on GitHub · 2026-11-25 00:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/519#issuecomment-7148092683) 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

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!519
No description provided.