XGameSave: a bad escape in a save name stays literal instead of panicking (#325) #443
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/448"
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 ivall/xcl. Originally posted by Amzi-01 on 2026-11-24T00:25:58Z.
decinhle/xgameruntime/gamesave.rssliced the&strby byte index. A save name with%, one ASCII byte and then a multi-byte character, such as a folder copied in by hand or restored from a backup, panicked. Becausedecruns from theextern "system"enumeration calls, that aborted the whole title with 0xC0000409 (confirmed on Windows by @jleybourne in the issue). It now decodes%XYfrom the bytes, and only when both are ASCII hex digits. That also stops%+1decoding to 0x01, becausefrom_str_radixaccepted a sign.Fixes #325
What is in it
dec: ahex_digithelper (char::to_digit(16), ASCII only, no sign) instead ofu8::from_str_radixon a slice. Namesencwrites decode as before.dec_keeps_bad_escapes_literal:%a\u{e9},%\u{e9}a,%+1,%-1xand a truncateda%4stay literal,%41%42cand%c3%A9still decode, anddec(enc(name)) == nameholds for multi-byte,%and Windows-special names.enumerating_a_container_with_a_bad_escape_does_not_abort: the issue's repro. A%a\u{e9}container folder is made by hand, thenXGameSaveEnumerateContainerInfolists it.main'sdec, the first test panics at the slice and the second aborts with "thread caused non-unwinding panic"; with this PR both pass.Tested
cargo build --workspacethencargo test --workspace --no-fail-fast -- --test-threads=4: 678 passed, 0 failed, 41 ignored (SKIPPED GPU tests:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware, both "no wave64")cargo test -p xcl --lib gamesave: 12 passedRegression run
main:
PR:
Not tested
AI use
upstream-sync referenced this pull request2026-11-24 06:58:39 +00:00
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T03:04:03Z.
Tested exact head
df34b7e(on its basea6f5f7a).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 678 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.Not tested
scripts/smoke.ps1(no title on this machine), AMD, wave64 hardware, a release build.AI use
Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T05:28:50Z.
Test run of
df34b7ea057fe570cc30eeb1bf3fb209014843b7on AMD RDNA4. I merged it onto currentmaine50836blocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 706 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 665 passed, 0 failed, 21 ignoredSKIPPED;dec_keeps_bad_escapes_literalandenumerating_a_container_with_a_bad_escape_does_not_abortpass.Review: Duplicate of #514 (open), and #325 has had other PRs too; all decode
%XXfrom bytes. This one also has the enumeration-level test (the issue's repro throughXGameSaveEnumerateContainerInfo), which is the stronger of the two. Only one should land.Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T14:15:39Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:41:55Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:08:54Z.
Triage (#1607) – head
df34b7eMain still decodes with
u8::from_str_radix(&file[i + 1..i + 3], 16)ingamesave.rs::dec, which panics on a '%' followed by a multi-byte character (#325). #1430 makes the samedecchange (byte-wise hex digits) but bundles it with quota and blob-URL changes; this PR is the earlier, focused fix with tests. #442, #457 and #514 (same fix) are closed.Nit: the two new tests are inserted between the doc comment of
names_windows_would_change_round_tripand its#[test], so that doc comment now sits ondec_keeps_bad_escapes_literal.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-02T20:07:34Z.
merge-check
base:
5ad98adbc3head:
df34b7ea05merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3007 passed, 0 failed, 52 ignored (3004 / 0 / 52 on
817eb1f, plus this PR's 2 tests and 1 that main gained since); SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps); failing: nonereview: read the whole diff (1 file, +46 -2). No blocking findings. Main still has the bug.
%+Every name
encwrites came back unchanged in both, 1,000,000 of 1,000,000. The%+case is the intended change, andencnever writes it.3) Not a regression, for a later change: a folder named
%aéby hand is now listed, but a title that opens the listed name gets the folder%25a%C3%A9, a new empty container. Before, the title aborted.4) Small: the new test sits between the doc comment of
names_windows_would_change_round_tripand that test, so the first two comment lines now belong to the wrong one.5) This head shows only the
PR descriptioncheck.Build and test (Windows, no GPU)has not run on it, so it needs a CI run before the merge. It builds and passes here.6) The PR is close to being closed as stale. It still merges cleanly and still fixes #325.
performance: none; a few byte comparisons per save name
verdict: safe to merge
hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.