fix(libSceGameCustomDataDialog): return arg-null for unwritable result #15759

Closed
StepFPV wants to merge 1 commit from upstream-pr/15759 into main
StepFPV commented 2026-11-04 13:06:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by StepFPV on 2026-11-04T13:06:53Z.


What

sceGameCustomDataDialogGetResultA copied its int32_t result into the guest result pointer with std::memcpy after a null check only, so a non-null but unmapped or unwritable guest pointer faulted (SIGSEGV) instead of returning an error. Route the write through GuestCopyOut_nid_no_patch and return COMMON_DIALOG_ERROR_ARG_NULL (0x80B8000D) when the checked write fails, as libSceMsgDialog.native already does for the same result-pointer case. Observable behaviour is otherwise unchanged. Dropped the now-unused <cstring> include.

Tested

Windows 11, full build (WinLibs GCC 15.2.0 UCRT, DWARF exceptions), ctest --test-dir build -R guest_game_custom_data_dialog passes. Added a regression case that passes unmapped guest pointers (1 and ~uintptr_t{0xfff}) to the finished dialog and asserts COMMON_DIALOG_ERROR_ARG_NULL with no crash. Reverting only the library to main (raw std::memcpy) makes the same test SIGSEGV; with the fix it returns the error code.

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:5154774884 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15759). Originally posted by [StepFPV](https://github.com/StepFPV) on 2026-11-04T13:06:53Z. --- ### What `sceGameCustomDataDialogGetResultA` copied its `int32_t` result into the guest `result` pointer with `std::memcpy` after a null check only, so a non-null but unmapped or unwritable guest pointer faulted (SIGSEGV) instead of returning an error. Route the write through `GuestCopyOut_nid_no_patch` and return `COMMON_DIALOG_ERROR_ARG_NULL` (`0x80B8000D`) when the checked write fails, as `libSceMsgDialog.native` already does for the same result-pointer case. Observable behaviour is otherwise unchanged. Dropped the now-unused `<cstring>` include. ### Tested Windows 11, full build (WinLibs GCC 15.2.0 UCRT, DWARF exceptions), `ctest --test-dir build -R guest_game_custom_data_dialog` passes. Added a regression case that passes unmapped guest pointers (`1` and `~uintptr_t{0xfff}`) to the finished dialog and asserts `COMMON_DIALOG_ERROR_ARG_NULL` with no crash. Reverting only the library to `main` (raw `std::memcpy`) makes the same test SIGSEGV; with the fix it returns the error code. ### 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

Pull request closed

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!15759
No description provided.