XGameSave: a "%" in a save folder name is decoded by bytes, not by slicing the str (#325) #437
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/442"
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 Rednaxeh on 2026-11-24T00:21:27Z.
decingamesave.rsturned%XXback into a byte by slicing the name at byte offsets and parsing withfrom_str_radix. A folder or file name with%, a hex digit and then a multi-byte character (%aé) made the slice end inside the character and panic;decruns on every name in the save provider's folder fromextern "system"entry points, so the panic cannot unwind andXGameSaveEnumerateContainerInfoended the title with0xC0000409. XCL'sencnever writes such a name, but a save folder restored from a backup or edited by hand can hold one.from_str_radixalso accepted a sign, so%+1decoded to the byte 1. Fixes #325.What is in it
crates/xcl/src/hle/xgameruntime/gamesave.rs:decreads the two bytes after%and decodes them only when both are hex digits; anything else is kept as it is. Two tests in the file'smod tests:dec_keeps_a_percent_without_two_hex_digits(%aé,%+1, a trailing%, and anenc/decround trip) anda_container_folder_named_percent_then_multibyte_is_enumerated(a hand-placed%aécontainer folder goes throughXGameSaveEnumerateContainerInfo).Tested
stable-x86_64-pc-windows-msvc, debug (release for the regression run); DXC 1.9.2602.17.main'sdec):dec_keeps_a_percent_without_two_hex_digitspanics atgamesave.rs:100:52(end byte index 3 is not a char boundary; it is inside 'é');a_container_folder_named_percent_then_multibyte_is_enumeratedaborts the test process (thread caused non-unwinding panic. aborting., exit code0xC0000409).cargo test -p xcl --lib -- hle::xgameruntime::gamesave::: 12 passed, 0 failed..\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4) withXCL_REQUIRE_GPU=wave64,mesh: 672 passed, 0 failed, 41 ignored, 0 SKIPPED.Regression run
scripts/smoke.ps1 -Game <folder>on a retail title, release builds, no uncommitted changes, one after the other on the machine above (a warm-up run ofmainfirst, not shown). Thegpu:line names the wrong adapter (the script's known issue); the GPU was the RX 7800 XT. Both blocks unedited.main3516080:this PR's head
e310370:Not tested
AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by ivall on 2026-11-24T11:20:31Z.
Closing in favor of #448 for #325. The comparison in #325 reports equivalent decoding behavior; #448 also includes an enumeration-level regression test and broader malformed-escape and round-trip cases. The fix remains unmerged. Thank you for the contribution.
upstream-sync referenced this pull request2026-11-24 19:06:45 +00:00
Pull request closed