XGameSave: a stray v18446744073709551615 folder makes an update lose the save in release builds (follow-up to #1729) #2497

Open
opened 2026-11-26 05:07:30 +00:00 by github-bot · 2 comments
Owner

@⁠Makto94 on GitHub · 2026-11-25 14:50 UTC · original

After #1729 the next version number is highest + 1, where highest comes from the largest canonical v<N> folder name. With a stray folder v18446744073709551615 (u64::MAX) next to a good v1:

  • Debug build: attempt to add with overflow panic in the update; no data lost.
  • Release build: the addition wraps to 0, the update commits to v0 (not canonical, so reads ignore it), returns S_OK, and then removes v1. Later reads find no readable version.

Fix used in a port: highest.checked_add(1); when it is None, return NO_ACCESS (already returned when no version is readable) before writing or removing anything. A regression test with a committed v1 and that stray folder fails before the fix in debug and release and passes after. Reference: https://github.com/LaunchDoesntCode/VI-Port/pull/187

Separate and unchanged from before #1729: a version folder whose manifest is valid but whose blobs are missing makes a read remove older versions.

**@⁠Makto94** on GitHub · 2026-11-25 14:50 UTC · [original](https://github.com/Marvisak/VIctory/issues/2497) After #1729 the next version number is `highest + 1`, where `highest` comes from the largest canonical `v<N>` folder name. With a stray folder `v18446744073709551615` (`u64::MAX`) next to a good `v1`: - Debug build: `attempt to add with overflow` panic in the update; no data lost. - Release build: the addition wraps to 0, the update commits to `v0` (not canonical, so reads ignore it), returns `S_OK`, and then removes `v1`. Later reads find no readable version. Fix used in a port: `highest.checked_add(1)`; when it is `None`, return `NO_ACCESS` (already returned when no version is readable) before writing or removing anything. A regression test with a committed `v1` and that stray folder fails before the fix in debug and release and passes after. Reference: https://github.com/LaunchDoesntCode/VI-Port/pull/187 Separate and unchanged from before #1729: a version folder whose manifest is valid but whose blobs are missing makes a read remove older versions.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:07:30 +00:00
Author
Owner

@⁠Creaa on GitHub · 2026-11-25 14:55 UTC · original

Taking this: highest.checked_add(1), and NO_ACCESS before anything is written or removed when it overflows, with the regression test you describe (a committed v1 next to a stray v18446744073709551615). PR shortly.

AI use: Claude Code (Claude Opus 5.5) drafted this.

**@⁠Creaa** on GitHub · 2026-11-25 14:55 UTC · [original](https://github.com/Marvisak/VIctory/issues/2497#issuecomment-7166030516) Taking this: `highest.checked_add(1)`, and `NO_ACCESS` before anything is written or removed when it overflows, with the regression test you describe (a committed `v1` next to a stray `v18446744073709551615`). PR shortly. AI use: Claude Code (Claude Opus 5.5) drafted this.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 16:02 UTC · original · edited 2026-11-26 00:45 UTC

Automated triage for the maintainers.

Confirmed on main (63bcca4), crates/victory-hle/src/modules/xgamesave.rs: current takes highest from every canonical v<N> name, including stray ones. The update computes v.highest + 1 unchecked. In release that wraps to 0, commit writes v0, which version_number rejects (n > 0), and the update then removes the old readable version. The trigger is a hand-made folder named v18446744073709551615, but the result is a lost save.

Open PR #2511 addresses it (#2525 was closed without merging).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 16:02 UTC · [original](https://github.com/Marvisak/VIctory/issues/2497#issuecomment-7167539395) · edited 2026-11-26 00:45 UTC <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-25T14:55:34Z at=2026-11-26T01:08:00Z --> Automated triage for the maintainers. Confirmed on `main` (63bcca4), `crates/victory-hle/src/modules/xgamesave.rs`: `current` takes `highest` from every canonical `v<N>` name, including stray ones. The update computes `v.highest + 1` unchecked. In release that wraps to 0, `commit` writes `v0`, which `version_number` rejects (`n > 0`), and the update then removes the old readable version. The trigger is a hand-made folder named `v18446744073709551615`, but the result is a lost save. Open PR #2511 addresses it (#2525 was closed without merging). --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
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#2497
No description provided.