fix(libSceVisionManager): reject a null count in GetNumOfRegisterUserDataSlot #15072

Merged
MarcZX10 merged 3 commits from upstream-pr/15072 into main 2026-11-08 12:51:12 +00:00
MarcZX10 commented 2026-11-02 14:05:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T14:05:39Z.


What

sceVisionManagerGetNumOfRegisterUserDataSlot wrote *count for a known library version without checking the pointer, so a null count crashed the host. It now returns ErrorInvalidArgument for a null pointer, matching the other null checks in that library. A debt note records the new result.

  • 2ac65501a1 fix(libSceVisionManager): reject a null count in sceVisionManagerGetNumOfRegisterUserDataSlot
  • f9e23488e7 test(libSceVisionManager): cover a null count in sceVisionManagerGetNumOfRegisterUserDataSlot
  • 4c40772977 docs(libSceVisionManager): document the null count result of GetNumOfRegisterUserDataSlot

Tested

  • Host: Linux, guest test archive build, lane 2.
  • ctest -R '^guest_firmware_constant_returns$' (target guest_firmware_constant_returns_tests): 100% passed.
  • Negative control: with the null check removed in a verify copy only, the same test segfaults (0% passed).
  • tools/check_conventions.py --base upstream/main: 0 errors. One warning about the length of docs/dev/debt/libSceVisionManager.md existed before this change.
  • git diff --check upstream/main: clean.

Not verified

  • The return value for a null count (ErrorInvalidArgument) follows the library's other null-pointer checks; it was not captured from the console.
  • Not run on Windows, macOS or console.

Checklist

  • Based on current main; no other open PR changes this function
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5121621409 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15072). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-02T14:05:39Z. --- ### What `sceVisionManagerGetNumOfRegisterUserDataSlot` wrote `*count` for a known library version without checking the pointer, so a null `count` crashed the host. It now returns `ErrorInvalidArgument` for a null pointer, matching the other null checks in that library. A debt note records the new result. - 2ac65501a1 fix(libSceVisionManager): reject a null count in sceVisionManagerGetNumOfRegisterUserDataSlot - f9e23488e7 test(libSceVisionManager): cover a null count in sceVisionManagerGetNumOfRegisterUserDataSlot - 4c40772977 docs(libSceVisionManager): document the null count result of GetNumOfRegisterUserDataSlot ### Tested - Host: Linux, guest test archive build, lane 2. - `ctest -R '^guest_firmware_constant_returns$'` (target `guest_firmware_constant_returns_tests`): 100% passed. - Negative control: with the null check removed in a verify copy only, the same test segfaults (0% passed). - `tools/check_conventions.py --base upstream/main`: 0 errors. One warning about the length of `docs/dev/debt/libSceVisionManager.md` existed before this change. - `git diff --check upstream/main`: clean. ### Not verified - The return value for a null count (`ErrorInvalidArgument`) follows the library's other null-pointer checks; it was not captured from the console. - Not run on Windows, macOS or console. ### Checklist - [x] Based on current `main`; no other open PR changes this function - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
BunnyFl commented 2026-11-02 14:54:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T14:54:23Z.

Review: COMMENTED


Answering @oneandonlydean's question from the firmware: the module doesn't check count, so the null result is a host-side guard.

Firmware 13.42's libSceVisionManager.sprx (system/priv/lib, sha256 b96cc40d93cd9484591048d92e6023e04f3571e352bdcf446052b879d226c83c) at 0x160d0 (kDHvQLi0PM4), read from disassembly only, not measured on a console:

160d0: cmp rdi, 0x1017000014043000 ; je 160fa  ; 160fa: eax = 0x10
160df: eax = 0x80e70000
160e4: cmp rdi, 0x1020000214072421 ; jne 16103 ; unknown version: return 0x80e70000, no store
160f3: eax = 0x1e
160ff: mov [rsi], eax ; xor eax, eax           ; direct store, no null test
16103: ret

So for either known version the console faults on a null count. An unknown version returns 0x80E70000 without touching it, which matches main. The guard is fine as a host-safety fallback. The debt sentence could read, for example: "Firmware 13.42 stores the slot count without checking the pointer, so the console faults on a null count; AnyPS5 returns 0x80E70000 instead."

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5738435978 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15072#pullrequestreview-5738435978). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-02T14:54:23Z. **Review:** COMMENTED --- Answering @oneandonlydean's question from the firmware: the module doesn't check `count`, so the null result is a host-side guard. Firmware 13.42's `libSceVisionManager.sprx` (`system/priv/lib`, sha256 `b96cc40d93cd9484591048d92e6023e04f3571e352bdcf446052b879d226c83c`) at `0x160d0` (`kDHvQLi0PM4`), read from disassembly only, not measured on a console: ``` 160d0: cmp rdi, 0x1017000014043000 ; je 160fa ; 160fa: eax = 0x10 160df: eax = 0x80e70000 160e4: cmp rdi, 0x1020000214072421 ; jne 16103 ; unknown version: return 0x80e70000, no store 160f3: eax = 0x1e 160ff: mov [rsi], eax ; xor eax, eax ; direct store, no null test 16103: ret ``` So for either known version the console faults on a null `count`. An unknown version returns `0x80E70000` without touching it, which matches `main`. The guard is fine as a host-safety fallback. The debt sentence could read, for example: "Firmware 13.42 stores the slot count without checking the pointer, so the console faults on a null `count`; AnyPS5 returns 0x80E70000 instead."
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!15072
No description provided.