fix(libSceSaveData.native): validate mount point termination in mount operations #12853

Merged
slopgobblercobbler merged 1 commit from upstream-pr/12853 into main 2026-11-02 16:14:37 +00:00
slopgobblercobbler commented 2026-10-29 12:45:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by slopgobblercobbler on 2026-10-29T12:45:37Z.


What

  • In core/libs/prx/libSceSaveData.native/Export.cpp, validate that SaveDataMountPoint contains a null-terminated string via isValidMountPoint before performing slot lookups in mount operations (getMountInfo, getParam, setParam, loadIcon, saveIcon, saveIconByPath, umount2).
  • Guard find_slot_by_mount_point against null pointers and bound trace logging with %.*s.
  • Document in docs/dev/debt/libSceSaveData.native.md (<1,000 characters, leading with divergence statement first).

Tested

  • Windows 11 (MSVC / Clang) and CTest suite.
  • Unit tests in core/libs/tests/GuestSaveDataMountStatus.cpp verify unterminated and terminated mount points across unmounted/mounted saves.
  • Community verification:
    • Verified by @JJenkx on Windows 11 Enterprise (Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7): guest_savedata_mount_status passes 3 of 3 (ctest --repeat until-fail:3); negative control with Export.cpp and SaveData.hpp reverted to main confirmed failing.
    • Verified by @jotitadev on Ubuntu 26.04 (i7-8700, GCC 15.2): guest_savedata_mount_status passes 3/3, all 7 guest_savedata_* tests pass; negative control with source reverted to main fails 3/3 across all 14 unterminated-point checks.
  • Verified python tools/check_conventions.py --base upstream/main --head HEAD passed with 0 findings.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5068244065 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12853). Originally posted by [slopgobblercobbler](https://github.com/slopgobblercobbler) on 2026-10-29T12:45:37Z. --- ### What - In `core/libs/prx/libSceSaveData.native/Export.cpp`, validate that `SaveDataMountPoint` contains a null-terminated string via `isValidMountPoint` before performing slot lookups in mount operations (`getMountInfo`, `getParam`, `setParam`, `loadIcon`, `saveIcon`, `saveIconByPath`, `umount2`). - Guard `find_slot_by_mount_point` against null pointers and bound trace logging with `%.*s`. - Document in `docs/dev/debt/libSceSaveData.native.md` (<1,000 characters, leading with divergence statement first). ### Tested - Windows 11 (MSVC / Clang) and CTest suite. - Unit tests in `core/libs/tests/GuestSaveDataMountStatus.cpp` verify unterminated and terminated mount points across unmounted/mounted saves. - Community verification: - Verified by @JJenkx on Windows 11 Enterprise (Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7): `guest_savedata_mount_status` passes 3 of 3 (`ctest --repeat until-fail:3`); negative control with `Export.cpp` and `SaveData.hpp` reverted to `main` confirmed failing. - Verified by @jotitadev on Ubuntu 26.04 (i7-8700, GCC 15.2): `guest_savedata_mount_status` passes 3/3, all 7 `guest_savedata_*` tests pass; negative control with source reverted to `main` fails 3/3 across all 14 unterminated-point checks. - Verified `python tools/check_conventions.py --base upstream/main --head HEAD` passed with 0 findings. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
jotitadev commented 2026-10-30 14:00:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-30T14:00:01Z.

Review: COMMENTED


First Linux run of this head (the body and the thread have Windows only).

Ubuntu 26.04, i7-8700, GCC 15.2, Release, BUILD_TESTING=ON. Head b01e0938b0 merged (--no-commit) onto current main f91137142e; the merge is clean.

  • guest_savedata_mount_status: passes 3/3.
  • All 7 guest_savedata_* tests pass.
  • public_headers: passes.
  • Control: with Export.cpp and SaveData.hpp from main and this PR's test kept, guest_savedata_mount_status fails 3/3: all 14 unterminated-point checks fail (umount2, loadIcon, saveIcon, saveIconByPath, getMountInfo, getParam, setParam, each unmounted and mounted).

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5713375162 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12853#pullrequestreview-5713375162). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-30T14:00:01Z. **Review:** COMMENTED --- First Linux run of this head (the body and the thread have Windows only). Ubuntu 26.04, i7-8700, GCC 15.2, Release, `BUILD_TESTING=ON`. Head `b01e0938b0` merged (`--no-commit`) onto current `main` `f91137142e`; the merge is clean. - `guest_savedata_mount_status`: passes 3/3. - All 7 `guest_savedata_*` tests pass. - `public_headers`: passes. - Control: with `Export.cpp` and `SaveData.hpp` from `main` and this PR's test kept, `guest_savedata_mount_status` fails 3/3: all 14 unterminated-point checks fail (`umount2`, `loadIcon`, `saveIcon`, `saveIconByPath`, `getMountInfo`, `getParam`, `setParam`, each unmounted and mounted). Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!12853
No description provided.