libSceUsbStorageDialog: dialog result and open operations fault on unwritable pointers instead of returning COMMON_DIALOG_ERROR_ARG_NULL #16045

Closed
opened 2026-11-05 12:53:31 +00:00 by pushkarreddyy · 0 comments
pushkarreddyy commented 2026-11-05 12:53:31 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-11-05T12:53:31Z.


What happens

In core/libs/prx/libSceUsbStorageDialog/Export.cpp, sceUsbStorageDialogGetResult and sceUsbStorageDialogOpen directly dereference caller-supplied pointer arguments (result->result, param->base, param->userId, etc.) without checking memory readability or writability.

When a guest title passes an unwritable or unmapped pointer (such as 0x10), host memory access triggers an unhandled memory fault / segmentation fault instead of safely returning COMMON_DIALOG_ERROR_ARG_NULL (0x80B8000D).

Proposed Fix

  1. Validate memory accessibility and copy guest buffers using GuestCopyIn_nid_no_patch and GuestCopyOut_nid_no_patch in sceUsbStorageDialogGetResult and sceUsbStorageDialogOpen.
  2. Return COMMON_DIALOG_ERROR_ARG_NULL (0x80B8000D) when guest pointer access fails.
  3. Add guest regression test coverage in core/libs/tests/GuestUsbStorageDialog.cpp.
  4. Document the host-safety fallback in docs/dev/debt/libSceUsbStorageDialog.md.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6223568655 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/16045). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-05T12:53:31Z. --- ### What happens In `core/libs/prx/libSceUsbStorageDialog/Export.cpp`, `sceUsbStorageDialogGetResult` and `sceUsbStorageDialogOpen` directly dereference caller-supplied pointer arguments (`result->result`, `param->base`, `param->userId`, etc.) without checking memory readability or writability. When a guest title passes an unwritable or unmapped pointer (such as `0x10`), host memory access triggers an unhandled memory fault / segmentation fault instead of safely returning `COMMON_DIALOG_ERROR_ARG_NULL` (`0x80B8000D`). ### Proposed Fix 1. Validate memory accessibility and copy guest buffers using `GuestCopyIn_nid_no_patch` and `GuestCopyOut_nid_no_patch` in `sceUsbStorageDialogGetResult` and `sceUsbStorageDialogOpen`. 2. Return `COMMON_DIALOG_ERROR_ARG_NULL` (`0x80B8000D`) when guest pointer access fails. 3. Add guest regression test coverage in `core/libs/tests/GuestUsbStorageDialog.cpp`. 4. Document the host-safety fallback in `docs/dev/debt/libSceUsbStorageDialog.md`.
Sign in to join this conversation.
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#16045
No description provided.