fix(libSceIcu): copy udat_* guest status pointers safely #20790

Merged
Zyylon merged 1 commit from upstream-pr/20790 into main 2026-11-15 16:09:08 +00:00
Zyylon commented 2026-11-15 15:34:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Zyylon on 2026-11-15T15:34:59Z.


What

  • Validate and update guest UErrorCode* status pointers in core/libs/prx/libSceIcu/DateFormat.cpp (udat_format_nid_postfix, udat_formatForFields_nid_postfix, udat_open_nid_postfix, and udat_toPattern_nid_postfix) via GuestCopyIn_nid_no_patch and GuestCopyOut_nid_no_patch while preserving errno, rejecting unreadable or unwritable pointers via NotImplemented_nid_no_patch(__func__)
  • Keep incoming failing *status > 0 short-circuiting and null-status validation unchanged
  • Add negative-control unreadable and read-only status pointer tests in core/libs/prx/libSceIcu/tests/DateFormat.cpp and document the change in docs/dev/debt/changes/fix-icu-date-format-guest-pointers.md

Tested

  • Pre-fix baseline: ctest --test-dir build -R "^guest_icu_recovered_signatures$" -V failed with Exception: SegFault (read of 0x0000000000000010 at libSceIcu.prx+0x3f169)
  • Post-fix: ctest --test-dir build -R "^guest_icu_recovered_signatures$" --repeat until-fail:5 -V passed 5/5 (Passed)
  • python tools/debt_fold.py --check passed
  • python tools/check_conventions.py --base origin/main passed
  • python tools/pr_overlap.py --branch fix/icu-date-format-guest-pointers --jobs 16 reported No overlap with open pull requests.

Checklist

  • Read CONTRIBUTING.md and CONVENTIONS before writing code.
  • Followed all rules in those documents and checked TechnicalDebt.md.
  • Used the branch naming convention and Conventional Commits for the PR title and commit subjects.
  • Ran the full test suite or targeted unit tests relevant to this change.
  • Added/updated tests covering the new or changed behaviour.
  • Added no comments in source files beyond those allowed by CONVENTIONS.md.
  • Made sure NotImplemented throws rather than faking success, and updated docs/dev/debt/.
  • Reused existing helpers and patterns instead of duplicating code.
  • Ran tools/check_conventions.py --base origin/main cleanly.
  • Ran tools/pr_overlap.py to check overlap with open PRs.
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5324274475 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20790). Originally posted by [Zyylon](https://github.com/Zyylon) on 2026-11-15T15:34:59Z. --- ### What - Validate and update guest `UErrorCode* status` pointers in `core/libs/prx/libSceIcu/DateFormat.cpp` (`udat_format_nid_postfix`, `udat_formatForFields_nid_postfix`, `udat_open_nid_postfix`, and `udat_toPattern_nid_postfix`) via `GuestCopyIn_nid_no_patch` and `GuestCopyOut_nid_no_patch` while preserving `errno`, rejecting unreadable or unwritable pointers via `NotImplemented_nid_no_patch(__func__)` - Keep incoming failing `*status > 0` short-circuiting and null-`status` validation unchanged - Add negative-control unreadable and read-only `status` pointer tests in `core/libs/prx/libSceIcu/tests/DateFormat.cpp` and document the change in `docs/dev/debt/changes/fix-icu-date-format-guest-pointers.md` ### Tested - Pre-fix baseline: `ctest --test-dir build -R "^guest_icu_recovered_signatures$" -V` failed with `Exception: SegFault` (`read of 0x0000000000000010` at `libSceIcu.prx+0x3f169`) - Post-fix: `ctest --test-dir build -R "^guest_icu_recovered_signatures$" --repeat until-fail:5 -V` passed `5/5` (`Passed`) - `python tools/debt_fold.py --check` passed - `python tools/check_conventions.py --base origin/main` passed - `python tools/pr_overlap.py --branch fix/icu-date-format-guest-pointers --jobs 16` reported `No overlap with open pull requests.` ### Checklist - [x] Read [CONTRIBUTING.md](CONTRIBUTING.md) and [CONVENTIONS](docs/dev/CONVENTIONS.md) before writing code. - [x] Followed all rules in those documents and checked [TechnicalDebt.md](docs/dev/TechnicalDebt.md). - [x] Used the branch naming convention and Conventional Commits for the PR title and commit subjects. - [x] Ran the full test suite or targeted unit tests relevant to this change. - [x] Added/updated tests covering the new or changed behaviour. - [x] Added no comments in source files beyond those allowed by `CONVENTIONS.md`. - [x] Made sure `NotImplemented` throws rather than faking success, and updated `docs/dev/debt/`. - [x] Reused existing helpers and patterns instead of duplicating code. - [x] Ran `tools/check_conventions.py --base origin/main` cleanly. - [x] Ran `tools/pr_overlap.py` to check overlap with open PRs. - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
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!20790
No description provided.