HLE: guard XGameSave version overflow and validate blobs before removing older versions #2523
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2525"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-25T15:16:41Z.
Fixes #2497
Problem
Update::submitcomputedv.highest + 1. With a strayv18446744073709551615(u64::MAX) folder next to a committedv1, debug builds panic and release builds wrap tov0(ignored on read), returnS_OK, and deletev1.load(dir)only verifiedmanifestwithout checking that each listed blob file0..blobs.len()exists as a regular file, so a newer version folder with a valid manifest and missing blob causedcurrent()to delete intact older versions.migrate()usedfilter_mapwithstd::fs::read(e.path()).ok()?, silently omitting unreadable blobs before committingv1and deleting the legacy folder.Fix
v.highest.checked_add(1)inUpdate::submit, returningNO_ACCESSon overflow before writing or deleting anything.load(dir)(returningOk(None)if missing/non-file, propagating other I/O errors).migrate()without deleting the legacy folder if any blob fails to read.Testing
an_unreadable_newer_version_does_not_cost_the_savewith amissing blobcase and addedstray_u64_max_version_does_not_lose_the_saveincrates/victory-hle/src/modules/xgamesave.rs.cargo test -p xtask --lockedpasses asset policy.Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T15:37:35Z.
Verification (Windows 11, WARP/CPU only) — head
a805860e302d2dbc8db9218cca5ae9b577d82039, with overlap against #2511Tested: the PR head =
origin/main940d32f+ the PR (merge-base940d32f, fast-forward). Windows 11 Pro 10.0.26200, rustc/cargo 1.98.1.VICTORY_D3D12_WARP=1with--features diagnosticsforvictory-hle(WARP for any host device; xgamesave itself is filesystem-only). No physical GPU.cargo test -p victory-hle --locked --features diagnostics --lib xgamesave -- --test-threads=1... --lib stray_u64_maxorigin/main's production code (tests kept)xgamesave.rs:511(highest + 1overflow)... --lib an_unreadable_newer(new "missing blob" case)origin/main's production code (panic atxgamesave.rs:1038)cargo test -p victory-hle --locked --features diagnostics --lib -- --test-threads=1cargo clippy -p victory-hle --all-targets [--features diagnostics] --locked -- -D warningscargo xtask policyasset policy: 182 files okDiff read: the
checked_addguard is the same as #2511's.loadnow stats each listed blob (0..n) and treats a missing or non-file blob as an unreadable version, so such a version is no longer picked as current and older versions are not removed behind it;migratenow aborts (None) on a failingread_direntry or blob read instead of skipping it. Observations, not blockers: (1) themigratechange is a behaviour change with no test of its own (one permanently unreadable entry now blocks migrating that folder, where before the blob was dropped silently); (2)loadnow costs onemetadatacall per blob per version scanned; (3) only existence/is_fileis checked, not size.Side by side with #2511 (head
b730d1e5): the overflow guard is the same single line (checked_add(1)->NO_ACCESS); the two conflict textually at that hunk only. Resolving it with either side and both PRs' tests: 13 xgamesave tests pass; with this PR's side, full lib 145 passed, 0 failed and clippy clean. This PR is a superset of #2511 (adds blob validation inload, the strictermigrate, and one more test case); #2511 is just the overflow fix.AI use: Claude Code (Claude Sonnet 5.5).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:54:57Z.
Automated triage for the maintainers. Merge candidate (a recommendation to look, not an approval).
In crates/victory-hle/src/modules/xgamesave.rs this fixes #2497 (
Update::submitnow refuses withNO_ACCESSwhenhighest + 1would overflow, instead of committing an unreadv0and removingv1), makesloadtreat a version whose listed blob files0..nare missing as unreadable socurrentno longer removes older versions behind it (the second case named in #2497), and makesmigratekeep the legacy folder when a blob fails to read instead of dropping that blob and deleting the folder. The overflow hunk is the same as #2511, which this PR includes, so only one of the two should land; themigratechange has no test of its own. CI: thecheckjob passes.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by jaschinski97-ops on 2026-11-25T18:00:25Z.
Review: COMMENTED
Native Windows 11 follow-up on unchanged head
a805860: the new sharing-denied legacy-blob migration regression fails on main13f91caand passes with #2525. This fills the migration test gap identified in the earlier review.A separate locked
.displaycase still reproduces after #2525: unreadable metadata becomes empty and a partial version is committed. Scoped follow-up #2675 retains the original #2525 commit/author and adds the NotFound-only fallback plus Windows blob/display retry regressions and the absent-metadata control. It prevents fresh partial migrations; it does not claim to repair previously damaged versions.Final HLE rerun150/150, Clippy alltargets/allfeatures with warnings denied and asset policy pass; the one earlier transient DirectStorage failure and successful reruns are documented in #2675. Rust1.98.1 WindowsGNU / LLVM-MinGW, native Windows11 build26300. AI-assisted with Codex; synthetic files only, no GPU/title data.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:10:28Z.
Automated triage for the maintainers, second look (a review against current
main, with builds and tests where they could change the verdict).Closing as covered by two other PRs: the
loadhunk is #1981's with fewer tests, and the overflow hunk is #2511's line. Themigratechange is untested and protects nothing: once the title saves under that name, the next provider open finds the new layout committed and deletes the legacy folder anyway.If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.
Pull request closed