[BUNDLE] XGameSave hardening: #228 #399 #570 #590 #1006 #1110 #1123 #1358

Closed
github-bot wants to merge 16 commits from gh-pr/1358/head into gh-pr/1358/base
Owner

@⁠MamaLeVrai on GitHub · 2026-11-24 17:35 UTC · original
MamaLeVrai:bundle/hle-xgamesave → main · +221 −11 · 1 files · 16 commits · closed without merging

One PR in place of 7. The XGameSave hardening PRs: bounds, version names, manifests and failed creates in the save container code (modules/xgamesave.rs). Every head is merged unchanged onto main (ffe310e), and the result is built and tested together.

For reviewers and for anyone verifying with an agent (Claude, Codex, a person): this is a [BUNDLE] PR. The re-verification commands are below, so one run covers all of it.

What is inside

PR Author Head Title
#228 Dufftwt 09ff84b6a XGameSave: a failed create leaves a null handle, as documented
#399 lordon1a 54f8cee58 xgamesave: preserve older versions on manifest error
#570 Quat3rnion 906ebe7b2 HLE: reject saves whose committed container lacks a manifest
#590 Quat3rnion 52ceb8f71 HLE: reject duplicate blob changes in one save update
#1006 NATON4 6a2c18e2f XGameSave: a folder named like a version, such as v01, does not remov…
#1110 divyeshganta d2ce71292 fix(hle): account for save replacements before clamping quota
#1123 EatCodeSleep2 4e32dfc78 Validate XGameSave blob count before reading

All of them merge with no conflict and no change of mine.

Verification

Windows 11, RX 6950 XT, Rust 1.98.1 (the pinned toolchain):

Check Result
cargo clippy --workspace --all-targets --locked -- -D warnings clean
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings clean
cargo test --workspace --locked 347 passed, 0 failed, 6 ignored (main: 342 passed, 6 ignored)

The title was not run, so this says nothing about in-game effect. No game data is used or committed.

Re-verify in one go

git fetch https://github.com/MamaLeVrai/VIctory.git bundle/hle-xgamesave
git checkout FETCH_HEAD
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
cargo test --workspace --locked

To confirm that no component PR moved since this was built, compare each Head above with gh pr view <n> --repo Marvisak/VIctory --json headRefOid. If one differs, the branch needs a rebuild: merge the new head in the same order.

If this lands

The component heads are in the history unchanged, so each PR's commits and authorship are kept and GitHub should mark them merged. Merging them one by one instead works too, with the exceptions noted above.

AI-assisted (Claude Code); no game data.

🤖 Generated with Claude Code

**@⁠MamaLeVrai** on GitHub · 2026-11-24 17:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/1358) `MamaLeVrai:bundle/hle-xgamesave` → `main` · +221 −11 · 1 files · 16 commits · closed without merging **One PR in place of 7.** The XGameSave hardening PRs: bounds, version names, manifests and failed creates in the save container code (`modules/xgamesave.rs`). Every head is merged unchanged onto `main` (`ffe310e`), and the result is built and tested together. > For reviewers and for anyone verifying with an agent (Claude, Codex, a person): this is a `[BUNDLE]` PR. The re-verification commands are below, so one run covers all of it. ## What is inside | PR | Author | Head | Title | |---|---|---|---| | #228 | Dufftwt | `09ff84b6a` | XGameSave: a failed create leaves a null handle, as documented | | #399 | lordon1a | `54f8cee58` | xgamesave: preserve older versions on manifest error | | #570 | Quat3rnion | `906ebe7b2` | HLE: reject saves whose committed container lacks a manifest | | #590 | Quat3rnion | `52ceb8f71` | HLE: reject duplicate blob changes in one save update | | #1006 | NATON4 | `6a2c18e2f` | XGameSave: a folder named like a version, such as v01, does not remov… | | #1110 | divyeshganta | `d2ce71292` | fix(hle): account for save replacements before clamping quota | | #1123 | EatCodeSleep2 | `4e32dfc78` | Validate XGameSave blob count before reading | All of them merge with no conflict and no change of mine. ## Verification Windows 11, RX 6950 XT, Rust 1.98.1 (the pinned toolchain): | Check | Result | |---|---| | `cargo clippy --workspace --all-targets --locked -- -D warnings` | clean | | `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` | clean | | `cargo test --workspace --locked` | 347 passed, 0 failed, 6 ignored (`main`: 342 passed, 6 ignored) | The title was not run, so this says nothing about in-game effect. No game data is used or committed. ## Re-verify in one go ```powershell git fetch https://github.com/MamaLeVrai/VIctory.git bundle/hle-xgamesave git checkout FETCH_HEAD cargo clippy --workspace --all-targets --locked -- -D warnings cargo clippy --workspace --all-targets --all-features --locked -- -D warnings cargo test --workspace --locked ``` To confirm that no component PR moved since this was built, compare each `Head` above with `gh pr view <n> --repo Marvisak/VIctory --json headRefOid`. If one differs, the branch needs a rebuild: merge the new head in the same order. ## If this lands The component heads are in the history unchanged, so each PR's commits and authorship are kept and GitHub should mark them merged. Merging them one by one instead works too, with the exceptions noted above. AI-assisted (Claude Code); no game data. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
XGameSaveCreateContainer, XGameSaveCreateUpdate and
XGameSaveInitializeProviderResult left the title's handle untouched when
they failed. The GDK documents those handles as null on failure, and
its own sample closes them on that basis ("if (containerContext)
XGameSaveCloseContainer(...)" on a variable it never initialized), so
a failed call made the title close whatever was on its stack: a heap
corruption far from the failure that caused it.

Each of the three now nulls the handle before anything can fail.
Keep existing quota excess in the accounting when replacing blobs. Cover quota recovery boundaries, deletions and disk-space errors with a pure regression. AI-assisted.
XGameSave permits only one write or delete per blob in an update. WriteBlob and DeleteBlob accepted repeats and submit silently kept the last one, so a title could pass locally but fail on a console. Refuse a second change to a blob already in the update, update the existing test that relied on write-then-delete, and keep the first change.
current() reported a missing manifest as NotFound, the same error as no container at all. An update then committed a fresh v1 and returned success while readers still selected the malformed newest version. A version directory that exists must have a readable manifest; anything else is InvalidData, which both readers and submit map to NO_ACCESS. Add a tempdir regression that removes the newest manifest and checks no new version is committed.
Recovery read every folder `v<digits>` as a committed version, so a `v01`,
`v001` or `v+1` beside the committed `v1` also counted as version 1. One
of the two was then "older" and removed by its rebuilt name, `v1`: the
committed save itself. Reading the newest version's manifest then failed
with NotFound, which reads as no save at all.

A version's folder is now only `v<N>` exactly as `commit` names it (no
sign, no leading zeros). Other names are not versions: recovery neither
counts nor removes them.

The new test commits a save, adds `v01`, `v001` and `v+1` folders, and
checks that the save reads back, the strays are left alone and the next
update goes on to `v2`.

Closes #870.
Merges #228 #399 #570 #590 #1006 #1110 #1123 onto main (ffe310e), each head
unchanged, no conflicts, no changes of mine. cargo clippy --workspace
--all-targets --locked -- -D warnings, with and without --all-features, is
clean and cargo test --workspace --locked passes (347 passed, 6 ignored;
main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:28:40 +00:00
github-bot closed this pull request 2026-11-26 04:28:40 +00:00
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-24 18:45 UTC · original

Runtime boot check on real hardware with a retail dump

Result: no difference from main in this test.

I merged head 144b620 onto main ffe310e (clean merge), built it (release), and ran victory run <title exe> --execute with an empty data folder for 100 s, without any input. I compared the run with main built and run the same way.

main ffe310e this PR
Reaches the first-boot screens yes yes
Caption at 100 s (one sample) 30 fps, 12 draws/frame 30 fps, 12 draws/frame
Frames presented 2,048 2,048
crashes.log entries 0 0
Committed memory 11.1 GB 11.1 GB

Warnings: 7, the same kinds and counts as on main. 0 errors.

Limits. Without input, the title stays on the first-boot screens. This run does not exercise saves, the intro video, the start screen, loading or the world. It shows only that the change does not break startup or the first menus on this machine. I did not run the PR's tests.

Machine: Ryzen 7 7800X3D, RTX 4070 SUPER, Windows 11 25H2, game 1.0.2.1. AI-assisted (Claude Code).

**@⁠sinan-cmyk** on GitHub · 2026-11-24 18:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/1358#issuecomment-7141108889) ### Runtime boot check on real hardware with a retail dump **Result: no difference from `main` in this test.** I merged head 144b620 onto `main` ffe310e (clean merge), built it (release), and ran `victory run <title exe> --execute` with an empty data folder for 100 s, without any input. I compared the run with `main` built and run the same way. | | `main` ffe310e | this PR | |---|---|---| | Reaches the first-boot screens | yes | yes | | Caption at 100 s (one sample) | 30 fps, 12 draws/frame | 30 fps, 12 draws/frame | | Frames presented | 2,048 | 2,048 | | `crashes.log` entries | 0 | 0 | | Committed memory | 11.1 GB | 11.1 GB | **Warnings:** 7, the same kinds and counts as on `main`. 0 errors. **Limits.** Without input, the title stays on the first-boot screens. This run does not exercise saves, the intro video, the start screen, loading or the world. It shows only that the change does not break startup or the first menus on this machine. I did not run the PR's tests. Machine: Ryzen 7 7800X3D, RTX 4070 SUPER, Windows 11 25H2, game 1.0.2.1. AI-assisted (Claude Code).
Author
Owner

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

Automated triage for the maintainers. Closing because this pull request re-packages other open pull requests. Each of those is reviewed on its own, so a bundle cannot be merged.

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:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/1358#issuecomment-7148722466) Automated triage for the maintainers. Closing because this pull request re-packages other open pull requests. Each of those is reviewed on its own, so a bundle cannot be merged. 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!1358
No description provided.