HLE: XSystemGetXboxLiveSandboxId refuses a buffer under 16 bytes #939

Open
github-bot wants to merge 2 commits from github-bot/gh-939 into main AGit
Owner

@⁠LouisRiverstone on GitHub · 2026-11-24 14:21 UTC · original
LouisRiverstone:hle/sandbox-id-buffer-minimum → main · +25 −0 · 1 files · 2 commits · open

Fixes #862.

XSystemGetXboxLiveSandboxId documents XSystemXboxLiveSandboxIdMaxBytes (16) as the minimum buffer and returns HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) below it. We only checked the 7 bytes "RETAIL\0" needs, so a 7–15 byte buffer succeeded here and failed on console.

sandbox_id now returns E_NOT_SUFFICIENT_BUFFER when size < 16, before put_string. put_string is unchanged.

Verify: cargo test -p victory-hle xsystem. The new test a_sandbox_id_buffer_under_the_documented_minimum_is_refused checks that sizes 7 and 15 are refused and leave the buffer alone, and that size 16 gives S_OK with used = 7.

🤖 Generated with Claude Code

**@⁠LouisRiverstone** on GitHub · 2026-11-24 14:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/939) `LouisRiverstone:hle/sandbox-id-buffer-minimum` → `main` · +25 −0 · 1 files · 2 commits · open Fixes #862. `XSystemGetXboxLiveSandboxId` documents `XSystemXboxLiveSandboxIdMaxBytes` (16) as the minimum buffer and returns `HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)` below it. We only checked the 7 bytes `"RETAIL\0"` needs, so a 7–15 byte buffer succeeded here and failed on console. `sandbox_id` now returns `E_NOT_SUFFICIENT_BUFFER` when `size < 16`, before `put_string`. `put_string` is unchanged. **Verify:** `cargo test -p victory-hle xsystem`. The new test `a_sandbox_id_buffer_under_the_documented_minimum_is_refused` checks that sizes 7 and 15 are refused and leave the buffer alone, and that size 16 gives `S_OK` with `used = 7`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:14:32 +00:00
Author
Owner

@⁠dcastell1 on GitHub · 2026-11-24 14:35 UTC · original

Verified on native Windows (no Wine): NVIDIA GeForce RTX 5090 (driver 621.24), Windows 11 10.0.26300, Rust 1.98.1, MSVC 14.44.35207, debug build. main@ffe310e baseline on this box: 342 passed, 0 failed, 6 ignored.

cargo test --workspace
343 passed; 0 failed; 6 ignored   (exit 0)

One more than the baseline; XSystemGetXboxLiveSandboxId refusing a short buffer is covered and green.

Tree restored afterwards (full diff against a clean checkout); no game data, the tests are synthetic. AI-assisted (opencode): applied the patch to a built tree, ran cargo test --workspace, reverted it.

**@⁠dcastell1** on GitHub · 2026-11-24 14:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/939#issuecomment-7134616529) Verified on native Windows (no Wine): NVIDIA GeForce RTX 5090 (driver 621.24), Windows 11 10.0.26300, Rust 1.98.1, MSVC 14.44.35207, debug build. `main@ffe310e` baseline on this box: **342 passed, 0 failed, 6 ignored**. ``` cargo test --workspace 343 passed; 0 failed; 6 ignored (exit 0) ``` One more than the baseline; `XSystemGetXboxLiveSandboxId` refusing a short buffer is covered and green. Tree restored afterwards (full diff against a clean checkout); no game data, the tests are synthetic. AI-assisted (opencode): applied the patch to a built tree, ran `cargo test --workspace`, reverted it.
Author
Owner

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

Thanks @⁠LouisRiverstone for the implementation and @⁠dcastell1 for the testing!

Just a quick heads-up: Issue #862 was claimed earlier (claim on #862) and our matching PR is open at #972. It enforces SANDBOX_ID_MAX_BYTES = 16 with unit tests verifying sizes 0, 7, and 15 return E_NOT_SUFFICIENT_BUFFER.

Would really appreciate community testing and verification on PR #972 as well to help @⁠Marvisak with review and integration!

**@⁠pushkarreddyy** on GitHub · 2026-11-24 14:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/939#issuecomment-7134854197) Thanks @⁠LouisRiverstone for the implementation and @⁠dcastell1 for the testing! Just a quick heads-up: Issue #862 was claimed earlier ([claim on #862](https://git.gtahub.st/github/Marvisak--VIctory/issues/862)) and our matching PR is open at #972. It enforces `SANDBOX_ID_MAX_BYTES = 16` with unit tests verifying sizes 0, 7, and 15 return `E_NOT_SUFFICIENT_BUFFER`. Would really appreciate community testing and verification on PR #972 as well to help @⁠Marvisak with review and integration!
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 15:40 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at d4306f4: cargo test -p victory-hle passes, 96 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 15:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/939#issuecomment-7136430269) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at d4306f4: `cargo test -p victory-hle` passes, 96 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:25 UTC · original · edited 2026-11-25 16:49 UTC

Automated triage for the maintainers.

Merge candidate.

sandbox_id in crates/victory-hle/src/modules/xsystem.rs now refuses any buffer under 16 bytes with E_NOT_SUFFICIENT_BUFFER before put_string runs. This matches issue #862. The new test checks sizes 7 and 15 (refused, with the buffer and used untouched) and size 16 (S_OK, used = 7).

Changed since the last review (new head 5a7687d): the doc comment on SANDBOX_ID_MAX_BYTES is now in plain terms and no longer names an identifier from the console SDK, which was the only thing asked for. Optional: the constant is a minimum, so a name like SANDBOX_ID_MIN_BUFFER would read better.

CI: check failing in emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index (victory-shader). This PR does not cause it: the PR touches only victory-hle, and that test-harness failure was fixed on main in 67e8ae1. The branch is based on an older main; a rebase or re-run should turn CI green.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/939#issuecomment-7149531542) · edited 2026-11-25 16:49 UTC <!-- victory-triage v1 head=5a7687dc22c75c611df31cc90aaee5eff0530d3e verdict=merge-candidate at=2026-11-25T16:44:54Z --> Automated triage for the maintainers. **Merge candidate.** `sandbox_id` in `crates/victory-hle/src/modules/xsystem.rs` now refuses any buffer under 16 bytes with `E_NOT_SUFFICIENT_BUFFER` before `put_string` runs. This matches issue #862. The new test checks sizes 7 and 15 (refused, with the buffer and `used` untouched) and size 16 (`S_OK`, `used = 7`). Changed since the last review (new head `5a7687d`): the doc comment on `SANDBOX_ID_MAX_BYTES` is now in plain terms and no longer names an identifier from the console SDK, which was the only thing asked for. Optional: the constant is a minimum, so a name like `SANDBOX_ID_MIN_BUFFER` would read better. CI: `check` failing in `emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index` (victory-shader). This PR does not cause it: the PR touches only victory-hle, and that test-harness failure was fixed on main in `67e8ae1`. The branch is based on an older main; a rebase or re-run should turn CI green. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 01:20 UTC · original

Code review and Windows 11 verification at head 5a7687dc22c7 merged cleanly onto main (63bcca43c6a0):

  • Code review (crates/victory-hle/src/modules/xsystem.rs:41, 68-73):
    • Enforces SANDBOX_ID_MAX_BYTES = 16 upfront, returning E_NOT_SUFFICIENT_BUFFER (0x8007_007A) without touching buffer or used when size < 16, and delegates size >= 16 cleanly to put_string(SANDBOX, size, buffer, used) (which also handles null buffer and writes "RETAIL\0" + used = 7).
  • Verified (Windows 11, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy -p victory-hle --all-targets -- -D warnings: 0 warnings
    • victory-hle: 153/153 unit + 2/2 integration passed (including a_sandbox_id_buffer_under_the_documented_minimum_is_refused).

LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 01:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/939#issuecomment-7179682550) Code review and Windows 11 verification at head `5a7687dc22c7` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review (`crates/victory-hle/src/modules/xsystem.rs:41, 68-73`)**: - Enforces `SANDBOX_ID_MAX_BYTES = 16` upfront, returning `E_NOT_SUFFICIENT_BUFFER` (`0x8007_007A`) without touching `buffer` or `used` when `size < 16`, and delegates `size >= 16` cleanly to `put_string(SANDBOX, size, buffer, used)` (which also handles null `buffer` and writes `"RETAIL\0"` + `used = 7`). - **Verified (Windows 11, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy -p victory-hle --all-targets -- -D warnings`: 0 warnings - `victory-hle`: **153/153 unit + 2/2 integration passed** (including `a_sandbox_id_buffer_under_the_documented_minimum_is_refused`). LGTM.
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/939/head:github-bot/gh-939'
git switch 'github-bot/gh-939'

Merge

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