fix(libSceIcu): validate and safely copy isError pointer in utf8_appendCharSafeBody #22164

Merged
Kikoarl merged 1 commit from upstream-pr/22164 into main 2026-11-17 10:39:05 +00:00
Kikoarl commented 2026-11-17 07:23:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-11-17T07:23:39Z.


What

Validate the optional isError guest pointer in utf8_appendCharSafeBody with GuestWritable_nid_no_patch upon entry and write the error indicator via GuestCopyOut_nid_no_patch on failure. Upfront probing on isError only executes when provided (null pointer append calls incur 0 probes at ~5.2 ns/call; non-null calls incur a single ~244 ns probe upfront) and copy-out occurs exclusively on failure, leaving valid paths and character iteration unhindered while utf8_nextCharSafeBody and utf8_prevCharSafeBody retain direct access to avoid inner-loop syscall overhead and Windows timeouts.

Tested

  • ctest --test-dir /tmp/anyps5_build -R "^guest_icu_utf8$" --output-on-failure
  • python3 tools/check_conventions.py --base origin/main

Checklist

  • Fixes: none
  • Unblocks: none
  • Depends on: none
  • GPUs tested: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5352633041 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22164). Originally posted by [Kikoarl](https://github.com/Kikoarl) on 2026-11-17T07:23:39Z. --- ### What Validate the optional `isError` guest pointer in `utf8_appendCharSafeBody` with `GuestWritable_nid_no_patch` upon entry and write the error indicator via `GuestCopyOut_nid_no_patch` on failure. Upfront probing on `isError` only executes when provided (null pointer append calls incur 0 probes at ~5.2 ns/call; non-null calls incur a single ~244 ns probe upfront) and copy-out occurs exclusively on failure, leaving valid paths and character iteration unhindered while `utf8_nextCharSafeBody` and `utf8_prevCharSafeBody` retain direct access to avoid inner-loop syscall overhead and Windows timeouts. ### Tested - `ctest --test-dir /tmp/anyps5_build -R "^guest_icu_utf8$" --output-on-failure` - `python3 tools/check_conventions.py --base origin/main` ### Checklist - [x] Fixes: none - [x] Unblocks: none - [x] Depends on: none - [x] GPUs tested: none - [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!22164
No description provided.