You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
XGameSave: a save file name with a non-ASCII character after '%' panics in an extern "system" call #325
dec in crates/xcl/src/hle/xgameruntime/gamesave.rs (line 100 on main85bdf21) slices &file[i + 1..i + 3] by byte index:
if b[i] == b'%' && i + 2 < b.len(){ifletOk(v) = u8::from_str_radix(&file[i + 1..i + 3],16){
When a name in the save folder has % followed by an ASCII byte and then a multi-byte UTF-8 character, the slice ends inside that character and panics (end byte index 3 is not a char boundary). dec runs on every directory and file name in the save folder during enumeration and reads, from extern "system" functions, where an unwinding panic aborts the process. XCL's own enc never writes such a name, so this requires a file placed there externally (e.g. copied by hand, restored from backup, or left by another tool).
Repro (clean-room, Linux):
Copied dec unchanged into a standalone test: dec("%a\u{e9}") panics.
Suggested fix:
Decode directly from b[i + 1] and b[i + 2], requiring both to be ASCII hex digits (u8::is_ascii_hexdigit), without slicing the &str. That also stops from_str_radix from accepting a leading sign such as "%+1". Add unit tests covering "%a\u{e9}" and "%+1".
Not tested: on Windows.
AI use: Initially found and reproduced with Claude Code; re-verified against main (85bdf21) with Antigravity (Gemini 4 Neon).
I'll take this. Plan: dec decodes %XY from b[i + 1] and b[i + 2] only when both are ASCII hex digits (no &str slicing, no from_str_radix), so %a\u{e9} stays literal instead of panicking and %+1 is no longer decoded to 0x01. Unit tests for both cases plus a round-trip with enc, and @jleybourne's enumeration repro (%a\u{e9} folder through XGameSaveEnumerateContainerInfo, no abort). Windows, RTX 3060 for the GPU suite. AI-assisted (Claude Code).
Fix in #457: dec now reads the two digits after % as bytes and requires both to be hex digits, so %aé no longer panics and %+1 / %-1 are no longer decoded. It comes with a unit test that panicked before the fix; the full suite passes on an RTX 3060 (677 passed, 0 failed on a6f5f7a).
I have no Xbox title to run scripts/smoke.ps1 on, so the PR has no regression run yet. If anyone who can run one has a minute, the two xcl-smoke blocks (main and the PR's head) would unblock it.
(Claude Code, Claude Opus 5.5, helped write this.)
Comparison of the four open PRs for this issue (#442, #448, #457, #514)
All four make the same fix: dec reads the two characters after % as bytes and decodes them only if both are ASCII hex digits. That fixes both cases in the issue, %aé (the panic) and %+1 (the sign). I read the four diffs against main (508a0c7) and found no difference in what the fixed dec returns. The PRs differ in their tests, their readiness and the regression runs.
Test through XGameSaveEnumerateContainerInfo (the abort path)
yes, own temp root, cleaned up
yes, real provider init under ASYNC_TEST_LOCK
no
no
Notes per PR
XGameSave: a "%" in a save folder name is decoded by bytes, not by slicing the str (#325) #442: Correct. The smallest change that still has an end-to-end test of the abort path. The enumeration test builds a Provider directly in its own temp dir. That is safe without ASYNC_TEST_LOCK, because enumeration runs synchronously and does not use XAsync. Its only blocker is that it is still a draft.
XGameSave: a bad escape in a save name stays literal instead of panicking (#325) #448: Correct, and it has the widest test cases. One defect: the new tests are inserted between the existing doc comment /// Names Windows does not keep as file names … and #[test] fn names_windows_would_change_round_trip. That doc comment now sits above the new test, and the existing test is left without one. Moving the two existing doc-comment lines back down fixes it.
Suggestion: merge #442 once it is marked ready for review. It was first, has no defects I could find, has both regression blocks and tests the abort path. If @Amzi-01 moves the misplaced doc comment, #448 is an equally good alternative with broader tests. Either way, #457 and #514 can be closed as duplicates. #448's round-trip names (sauvegarde été, 保存1, 100%) would be a nice addition to whichever PR is merged.
Not tested: I compared the diffs by reading them. I did not build or run any of the four branches.
Comparison of the four open PRs for #325 (#442, #448, #457, #514), to help pick one.
All four make the same fix: dec reads the two hex digits from bytes instead of slicing the &str, and a sign is no longer taken as a digit. The decoded output is the same in all four for every input I tried. Each diff touches only crates/xcl/src/hle/xgameruntime/gamesave.rs. I read all four diffs before running them: no network, process, build.rs or file access outside the test temp folders.
cargo test -p xcl --lib -- --test-threads=4 on each head: #442 632 passed, #448 638 passed, #457 637 passed, #514 638 passed. All had 0 failed and 21 ignored. The counts differ because the PRs start from different main commits.
Negative control: with main's dec put back, the new tests in #442 and #448 fail. The enumeration tests abort the test process at the panic across extern "system", which is #325 itself.
Points:
XGameSave: a bad escape in a save name stays literal instead of panicking (#325) #448: the new test went in between the existing doc comment ("Names Windows does not keep as file names …") and names_windows_would_change_round_trip. That comment now sits on dec_keeps_bad_escapes_literal, and the old test has lost its doc. Its enumeration test also creates the provider through XGameSaveInitializeProvider. It then removes only the container, so each run leaves %TEMP%\xcl_unit_data\gamesave\xcl-test-325-<pid> behind. Its round-trip loop (enc → dec over device names, a trailing dot, CJK) covers the most of the four.
Suggestion: merge #442, which was opened first, passes the checks and leaves nothing behind. #448's round-trip cases could be added to #442's test. Close the other three as duplicates.
Tested on an i7-12700H with an RTX 3070 Ti Laptop, Windows 11 build 26200. Toolchain: rustc 1.100.0 x86_64-pc-windows-gnullvm, debug, --lib tests only. Not tested: the MSVC toolchain, cargo test --workspace, smoke runs.
Written with Claude Code (Claude Opus 5.5). I checked each point above against the diffs and the test runs.
Empirical adjudication of the four PRs on this issue, run 2026-11-24 (Linux, x86_64-pc-windows-gnu cross-build, tests under Wine 9). Canonical battery, added as unit tests to main and each PR head: dec("%a\u{e9}") (char-boundary case), dec("%+1") (signed form), dec("%41A") ("AA"), dec("x%4y%zz") (literals).
head
%a\u{e9}
%+1
%41A
x%4y%zz
battery
PR-description check
main
panics at gamesave.rs:100 (confirms the report exactly)
All four converge on the same fix shape (decode the two digits from b[i+1]/b[i+2] with an ASCII-hexdigit check, no &str slicing, no from_str_radix) and are behaviourally equivalent under the battery; diffs are 33–54 added lines in gamesave.rs only.
Recommendation for the batch merge: #448 — behaviourally equal, cleanest shape (named hex_digit helper rather than a closure or inline cast), smallest deletion count (2 lines), and its description check is green like #442's; #457/#514 are one description-fix away but duplicative regardless. Suggest: merge #448 (or #442 if the maintainer prefers its inline style), close the other three as duplicates — all four authors independently verified the same two defects.
Repro of the harness: cross-build per #520 (llvm-mingw linker, static libunwind.a first in the search path), cargo test -p xcl --lib --target x86_64-pc-windows-gnu zz_325_review with CARGO_TARGET_…_RUNNER=wine.
Activity
Amzi-01 commentedon Nov 24, 2026
I'll take this. Plan:
decdecodes%XYfromb[i + 1]andb[i + 2]only when both are ASCII hex digits (no&strslicing, nofrom_str_radix), so%a\u{e9}stays literal instead of panicking and%+1is no longer decoded to 0x01. Unit tests for both cases plus a round-trip withenc, and @jleybourne's enumeration repro (%a\u{e9}folder throughXGameSaveEnumerateContainerInfo, no abort). Windows, RTX 3060 for the GPU suite. AI-assisted (Claude Code).raulmesa96 commentedon Nov 24, 2026
Fix in #457:
decnow reads the two digits after%as bytes and requires both to be hex digits, so%aéno longer panics and%+1/%-1are no longer decoded. It comes with a unit test that panicked before the fix; the full suite passes on an RTX 3060 (677 passed, 0 failed ona6f5f7a).I have no Xbox title to run
scripts/smoke.ps1on, so the PR has no regression run yet. If anyone who can run one has a minute, the twoxcl-smokeblocks (main and the PR's head) would unblock it.(Claude Code, Claude Opus 5.5, helped write this.)
Grimkaaah commentedon Nov 24, 2026
Opened #514 — decode %XX from bytes only (no str slice panic, no %+1).
PurpleDizzy commentedon Nov 24, 2026
Comparison of the four open PRs for this issue (#442, #448, #457, #514)
All four make the same fix:
decreads the two characters after%as bytes and decodes them only if both are ASCII hex digits. That fixes both cases in the issue,%aé(the panic) and%+1(the sign). I read the four diffs againstmain(508a0c7) and found no difference in what the fixeddecreturns. The PRs differ in their tests, their readiness and the regression runs.PR descriptioncheckxcl-smokeblocks (main + head)decencround tripencround tripXGameSaveEnumerateContainerInfo(the abort path)ASYNC_TEST_LOCKNotes per PR
Providerdirectly in its own temp dir. That is safe withoutASYNC_TEST_LOCK, because enumeration runs synchronously and does not use XAsync. Its only blocker is that it is still a draft./// Names Windows does not keep as file names …and#[test] fn names_windows_would_change_round_trip. That doc comment now sits above the new test, and the existing test is left without one. Moving the two existing doc-comment lines back down fixes it.x%4€ycovers a multi-byte character in the second digit's position). It has no main-side smoke block, soPR descriptionfails. It also has no end-to-end test.hex_nibble's_ => 0arm is unreachable after theis_ascii_hexdigitcheck. It also adds a blank line before the final}of the test module.Suggestion: merge #442 once it is marked ready for review. It was first, has no defects I could find, has both regression blocks and tests the abort path. If @Amzi-01 moves the misplaced doc comment, #448 is an equally good alternative with broader tests. Either way, #457 and #514 can be closed as duplicates. #448's round-trip names (
sauvegarde été,保存1,100%) would be a nice addition to whichever PR is merged.Not tested: I compared the diffs by reading them. I did not build or run any of the four branches.
(Claude Code, Opus 5.5, helped write this.)
lordon1a commentedon Nov 24, 2026
Comparison of the four open PRs for #325 (#442, #448, #457, #514), to help pick one.
All four make the same fix:
decreads the two hex digits from bytes instead of slicing the&str, and a sign is no longer taken as a digit. The decoded output is the same in all four for every input I tried. Each diff touches onlycrates/xcl/src/hle/xgameruntime/gamesave.rs. I read all four diffs before running them: no network, process,build.rsor file access outside the test temp folders.PR descriptioncheckmainf4ce27ccargo test -p xcl --lib -- --test-threads=4on each head: #442 632 passed, #448 638 passed, #457 637 passed, #514 638 passed. All had 0 failed and 21 ignored. The counts differ because the PRs start from differentmaincommits.Negative control: with
main'sdecput back, the new tests in #442 and #448 fail. The enumeration tests abort the test process at the panic acrossextern "system", which is #325 itself.Points:
names_windows_would_change_round_trip. That comment now sits ondec_keeps_bad_escapes_literal, and the old test has lost its doc. Its enumeration test also creates the provider throughXGameSaveInitializeProvider. It then removes only the container, so each run leaves%TEMP%\xcl_unit_data\gamesave\xcl-test-325-<pid>behind. Its round-trip loop (enc→decover device names, a trailing dot, CJK) covers the most of the four.Provideron its own temp root and deletes the whole root afterwards. It leaves nothing behind and does not depend on the provider's data folder.Suggestion: merge #442, which was opened first, passes the checks and leaves nothing behind. #448's round-trip cases could be added to #442's test. Close the other three as duplicates.
Tested on an i7-12700H with an RTX 3070 Ti Laptop, Windows 11 build 26200. Toolchain: rustc 1.100.0
x86_64-pc-windows-gnullvm, debug,--libtests only. Not tested: the MSVC toolchain,cargo test --workspace, smoke runs.Written with Claude Code (Claude Opus 5.5). I checked each point above against the diffs and the test runs.
pickles976 commentedon Nov 24, 2026
Empirical adjudication of the four PRs on this issue, run 2026-11-24 (Linux,
x86_64-pc-windows-gnucross-build, tests under Wine 9). Canonical battery, added as unit tests tomainand each PR head:dec("%a\u{e9}")(char-boundary case),dec("%+1")(signed form),dec("%41A")("AA"),dec("x%4y%zz")(literals).%a\u{e9}%+1%41Ax%4y%zzmaingamesave.rs:100(confirms the report exactly)0x01(second defect confirmed)All four converge on the same fix shape (decode the two digits from
b[i+1]/b[i+2]with an ASCII-hexdigit check, no&strslicing, nofrom_str_radix) and are behaviourally equivalent under the battery; diffs are 33–54 added lines ingamesave.rsonly.Recommendation for the batch merge: #448 — behaviourally equal, cleanest shape (named
hex_digithelper rather than a closure or inline cast), smallest deletion count (2 lines), and its description check is green like #442's; #457/#514 are one description-fix away but duplicative regardless. Suggest: merge #448 (or #442 if the maintainer prefers its inline style), close the other three as duplicates — all four authors independently verified the same two defects.Repro of the harness: cross-build per #520 (llvm-mingw linker, static
libunwind.afirst in the search path),cargo test -p xcl --lib --target x86_64-pc-windows-gnu zz_325_reviewwithCARGO_TARGET_…_RUNNER=wine.XGameSave: a bad escape in a save name stays literal instead of panic…