HLE: report required size on string getter buffer errors #446

Open
github-bot wants to merge 1 commit from github-bot/gh-446 into main AGit
Owner

@⁠enzoduarte1 on GitHub · 2026-11-24 03:30 UTC · original
enzoduarte1:hle/put-string-required-size → main · +49 −0 · 1 files · 1 commits · open

What

xgameruntime::put_string returned E_NOT_SUFFICIENT_BUFFER without touching used when the title passed no buffer (or one that was too small). String getters in this runtime use the usual two-call pattern — call with no buffer to learn the required size, then call again with that buffer — so the first call could not get an answer.

The error branch now writes text.len() + 1 through used when it is non-null, and leaves the buffer untouched on failure. Exact-fit and null-used behavior are unchanged. A test covers the size query, the follow-up fetch, a short buffer and a caller that does not ask for the size.

Tested

  • Windows 11, Rust 1.98.1, x86_64-pc-windows-gnu (no MSVC linker on this machine).
  • cargo test -p victory-hle --lib xgameruntime::: 2 passed.
  • cargo test --workspace --exclude victory-loader -- --test-threads=1: all suites passed.
  • cargo clippy -p victory-hle --all-targets -- -A clippy::field_reassign_with_default -D warnings: clean. The allowed lint is the pre-existing warning fixed by PR #355.
  • rustfmt --edition 2024 --check crates/victory-hle/src/modules/xgameruntime.rs and git diff --check: clean.
  • cargo xtask policy: 151 files ok. No game files or data taken from them were added.
  • Not tested: cargo test -p victory-loader --test load_probe. Its fixture passes MSVC's /DELAYLOAD flag, which MinGW rejects here; the same failure occurs on unmodified main.

Checklist

  • cargo fmt, cargo clippy --workspace --all-targets and cargo test --workspace pass — see the toolchain limitations above; the changed crate is clean.
  • cargo xtask policy passes. The change adds no game files or data taken from them (docs/asset-policy.md).
  • If an AI tool wrote part of this change, the description says so: an AI tool assisted with the code and test; I reviewed and ran them.
**@⁠enzoduarte1** on GitHub · 2026-11-24 03:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/446) `enzoduarte1:hle/put-string-required-size` → `main` · +49 −0 · 1 files · 1 commits · open ## What `xgameruntime::put_string` returned `E_NOT_SUFFICIENT_BUFFER` without touching `used` when the title passed no buffer (or one that was too small). String getters in this runtime use the usual two-call pattern — call with no buffer to learn the required size, then call again with that buffer — so the first call could not get an answer. The error branch now writes `text.len() + 1` through `used` when it is non-null, and leaves the buffer untouched on failure. Exact-fit and null-`used` behavior are unchanged. A test covers the size query, the follow-up fetch, a short buffer and a caller that does not ask for the size. ## Tested - Windows 11, Rust 1.98.1, `x86_64-pc-windows-gnu` (no MSVC linker on this machine). - `cargo test -p victory-hle --lib xgameruntime::`: 2 passed. - `cargo test --workspace --exclude victory-loader -- --test-threads=1`: all suites passed. - `cargo clippy -p victory-hle --all-targets -- -A clippy::field_reassign_with_default -D warnings`: clean. The allowed lint is the pre-existing warning fixed by PR #355. - `rustfmt --edition 2024 --check crates/victory-hle/src/modules/xgameruntime.rs` and `git diff --check`: clean. - `cargo xtask policy`: 151 files ok. No game files or data taken from them were added. - Not tested: `cargo test -p victory-loader --test load_probe`. Its fixture passes MSVC's `/DELAYLOAD` flag, which MinGW rejects here; the same failure occurs on unmodified `main`. ## Checklist - [ ] `cargo fmt`, `cargo clippy --workspace --all-targets` and `cargo test --workspace` pass — see the toolchain limitations above; the changed crate is clean. - [x] `cargo xtask policy` passes. The change adds no game files or data taken from them (`docs/asset-policy.md`). - [x] If an AI tool wrote part of this change, the description says so: an AI tool assisted with the code and test; I reviewed and ran them.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:04:12 +00:00
Author
Owner

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

Automated triage for the maintainers.

Needs work. This changes a runtime return value: put_string in crates/victory-hle/src/modules/xgameruntime.rs would write the required size through used on E_NOT_SUFFICIENT_BUFFER. Its callers (xsystem.rs, xuser.rs, storage.rs) implement getters whose public documentation describes fixed-size buffers with documented maximum sizes; none is documented as call-once-to-get-the-size, and the docs don't say used is written on failure. Please add evidence that the real runtime writes used on this error (public documentation for a specific getter, or the title's call sites relying on it) and name the caller that needs it.

CI: no check runs on the head commit.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/446#issuecomment-7148576872) <!-- victory-triage v1 head=881caef98fa0e2e08c4b37fd1f6e2d759aa2f40c verdict=needs-work at=2026-11-25T00:22:34Z --> Automated triage for the maintainers. **Needs work.** This changes a runtime return value: `put_string` in `crates/victory-hle/src/modules/xgameruntime.rs` would write the required size through `used` on `E_NOT_SUFFICIENT_BUFFER`. Its callers (`xsystem.rs`, `xuser.rs`, `storage.rs`) implement getters whose public documentation describes fixed-size buffers with documented maximum sizes; none is documented as call-once-to-get-the-size, and the docs don't say `used` is written on failure. Please add evidence that the real runtime writes `used` on this error (public documentation for a specific getter, or the title's call sites relying on it) and name the caller that needs it. CI: no check runs on the head commit. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/446/head:github-bot/gh-446'
git switch 'github-bot/gh-446'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-446'
git switch 'github-bot/gh-446'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-446'
git switch 'github-bot/gh-446'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-446'
git switch 'main'
git merge --squash 'github-bot/gh-446'
git switch 'main'
git merge --ff-only 'github-bot/gh-446'
git switch 'main'
git merge 'github-bot/gh-446'
git push origin 'main'
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!446
No description provided.