XGameSave: decode %XX in save file names without slicing the name (#325) #457

Closed
github-bot wants to merge 1 commit from gh-pr/457/head into gh-pr/457/base
Owner

@⁠raulmesa96 on GitHub · 2026-11-24 00:32 UTC · original
raulmesa96:xgamesave-dec-no-panic → main · +25 −2 · 1 files · 1 commits · closed without merging

dec in gamesave.rs sliced the save file name by byte index after a %; a name with a multi-byte character right after %x panicked inside an extern "system" call and aborted the process. It now reads the two digits as bytes, and both must be hex digits (so %+1 / %-1 are no longer decoded). Names XCL writes itself (enc) decode as before.

Fixes #325

What is in it

  • dec reads the escape's digits as bytes – crates/xcl/src/hle/xgameruntime/gamesave.rs
  • unit test dec_keeps_percent_not_followed_by_two_hex_digits (panicked with end byte index 3 is not a char boundary before the fix) – same file

Tested

  • NVIDIA GeForce RTX 3060 (driver 32.0.16.1088), Intel Core i5-12600K, Windows 11 25H2 build 26200, Rust 1.100.0 x86_64-pc-windows-msvc, debug
  • head aebea99 on main a6f5f7a, clean tree
  • cargo build --workspace then cargo test --workspace --no-fail-fast -- --test-threads=4: 677 passed, 0 failed, 41 ignored (the xcl lib: 637 passed, 0 failed, 21 ignored)
  • SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64)
  • cargo test -p xcl --lib gamesave: 11 passed, 0 failed

Regression run

  • none: I have no Xbox title to run scripts/smoke.ps1 on. The change is limited to dec (decoding save file names) and is covered by the unit tests and the full suite above; I would be grateful if someone with a title could add the two xcl-smoke blocks.

Not tested

  • the regression run on a real title (see above)
  • AMD GPUs
  • a retail title writing or reading saves with such names

AI use

  • Claude Code with Claude Opus 5.5: wrote the fix, the test and this description; the tests above were run by it on the hardware named.

🤖 Generated with Claude Code

**@⁠raulmesa96** on GitHub · 2026-11-24 00:32 UTC · [original](https://github.com/xcl-dev/xcl/pull/457) `raulmesa96:xgamesave-dec-no-panic` → `main` · +25 −2 · 1 files · 1 commits · closed without merging `dec` in `gamesave.rs` sliced the save file name by byte index after a `%`; a name with a multi-byte character right after `%x` panicked inside an `extern "system"` call and aborted the process. It now reads the two digits as bytes, and both must be hex digits (so `%+1` / `%-1` are no longer decoded). Names XCL writes itself (`enc`) decode as before. Fixes #325 **What is in it** - `dec` reads the escape's digits as bytes – `crates/xcl/src/hle/xgameruntime/gamesave.rs` - unit test `dec_keeps_percent_not_followed_by_two_hex_digits` (panicked with `end byte index 3 is not a char boundary` before the fix) – same file **Tested** - NVIDIA GeForce RTX 3060 (driver 32.0.16.1088), Intel Core i5-12600K, Windows 11 25H2 build 26200, Rust 1.100.0 `x86_64-pc-windows-msvc`, debug - head `aebea99` on `main` `a6f5f7a`, clean tree - `cargo build --workspace` then `cargo test --workspace --no-fail-fast -- --test-threads=4`: 677 passed, 0 failed, 41 ignored (the `xcl` lib: 637 passed, 0 failed, 21 ignored) - SKIPPED: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` (no wave64) - `cargo test -p xcl --lib gamesave`: 11 passed, 0 failed **Regression run** - none: I have no Xbox title to run `scripts/smoke.ps1` on. The change is limited to `dec` (decoding save file names) and is covered by the unit tests and the full suite above; I would be grateful if someone with a title could add the two `xcl-smoke` blocks. **Not tested** - the regression run on a real title (see above) - AMD GPUs - a retail title writing or reading saves with such names **AI use** - Claude Code with Claude Opus 5.5: wrote the fix, the test and this description; the tests above were run by it on the hardware named. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`dec` sliced `&file[i + 1..i + 3]` by byte index, so a name in the save
folder with '%', an ASCII byte and then a multi-byte character (e.g.
"%aé", copied there by hand or by another tool) panicked on a char
boundary. `dec` runs during enumeration and reads from `extern "system"`
functions, where the panic aborts the process. The two digits are now
read as bytes and must both be hex digits, which also stops
`from_str_radix` from taking a sign ("%+1" was decoded as 0x01).

Fixes #325

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:22:26 +00:00
github-bot closed this pull request 2026-11-26 04:22:26 +00:00
Author
Owner

@⁠raylitebull on GitHub · 2026-11-24 10:44 UTC · original

Closing as a duplicate of #442 / #448 for #325, which pass the PR description check (whereas this PR fails PR description).

**@⁠raylitebull** on GitHub · 2026-11-24 10:44 UTC · [original](https://github.com/xcl-dev/xcl/pull/457#issuecomment-7129173181) Closing as a duplicate of #442 / #448 for #325, which pass the `PR description` check (whereas this PR fails `PR description`).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.