feat(libSceIcu): implement the locale display exports #24335

Closed
larpsahur333 wants to merge 1 commit from upstream-pr/24335 into main
larpsahur333 commented 2026-11-20 14:22:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by larpsahur333 on 2026-11-20T14:22:07Z.


What

Eight libSceIcu exports that answered NotImplemented_nid_no_patch now forward to ICU 78.1's own entry points:

  • uloc_getDisplayName, uloc_getDisplayLanguage, uloc_getDisplayScript, uloc_getDisplayCountry, uloc_getDisplayVariant
  • uloc_getDisplayKeyword, uloc_getDisplayKeywordValue
  • uloc_getLineOrientation

Each one reads its guest locale strings through CopyGuestString, calls ICU with host strings, and copies the result out of a bounded host UChar buffer through GuestCopyOut. The guest UErrorCode word is copied in and out through GuestCopyIn/GuestCopyOut instead of being dereferenced, and a null status is answered without a write. A null output with a positive capacity, a negative capacity and a capacity above 8192 report U_ILLEGAL_ARGUMENT_ERROR.

In ICU 78 these entry points live in common/locdispnames.cpp and common/locresdata.cpp, which the curated icu_common target did not compile. cmake/Icu.cmake adds them together with the translation units they call (locdspnm.cpp, simpleformatter.cpp, static_unicode_sets.cpp, ucurr.cpp, ulist.cpp, usetiter.cpp, ustrcase_locale.cpp), the same way the earlier locale work added uloc.cpp, uloc_tag.cpp and uloc_keytype.cpp. locdspnm.cpp is built with UCONFIG_NO_BREAK_ITERATION because this ICU subset has no break iterator.

Tested

Windows 11 x86-64, MinGW-w64 GCC 15.2.0 (WinLibs), CMake 3.29.2, Ninja.

guest_icu_locale_display (new, core/libs/prx/libSceIcu/tests/LocaleDisplay.cpp) passes. It initialises the guest heap, then for the seven exports that write a buffer:

  • a null output with a positive capacity returns 0 and reports U_ILLEGAL_ARGUMENT_ERROR
  • a negative capacity returns 0 and reports U_ILLEGAL_ARGUMENT_ERROR
  • a capacity above 8192 returns 0 and reports U_ILLEGAL_ARGUMENT_ERROR

and for every export, uloc_getLineOrientation included:

  • a null status does not crash and writes nothing; uloc_getLineOrientation answers ULOC_LAYOUT_UNKNOWN

Not covered: this build ships no icudt data, so no display name can be produced. The test asserts the argument checks and the null-status paths only and never compares display text; the names themselves need a title that loads ICU data through udata_setCommonData.

python core/libs/tests/test_public_headers.py --compiler g++ reports 413 libraries, 34755 exports: unique declarations and umbrella coverage verified and Standalone headers verified.

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 and the licence notice of code adapted from upstream
  • 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
  • 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:5414887089 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24335). Originally posted by [larpsahur333](https://github.com/larpsahur333) on 2026-11-20T14:22:07Z. --- ### What Eight `libSceIcu` exports that answered `NotImplemented_nid_no_patch` now forward to ICU 78.1's own entry points: - `uloc_getDisplayName`, `uloc_getDisplayLanguage`, `uloc_getDisplayScript`, `uloc_getDisplayCountry`, `uloc_getDisplayVariant` - `uloc_getDisplayKeyword`, `uloc_getDisplayKeywordValue` - `uloc_getLineOrientation` Each one reads its guest locale strings through `CopyGuestString`, calls ICU with host strings, and copies the result out of a bounded host `UChar` buffer through `GuestCopyOut`. The guest `UErrorCode` word is copied in and out through `GuestCopyIn`/`GuestCopyOut` instead of being dereferenced, and a null status is answered without a write. A null output with a positive capacity, a negative capacity and a capacity above 8192 report `U_ILLEGAL_ARGUMENT_ERROR`. In ICU 78 these entry points live in `common/locdispnames.cpp` and `common/locresdata.cpp`, which the curated `icu_common` target did not compile. `cmake/Icu.cmake` adds them together with the translation units they call (`locdspnm.cpp`, `simpleformatter.cpp`, `static_unicode_sets.cpp`, `ucurr.cpp`, `ulist.cpp`, `usetiter.cpp`, `ustrcase_locale.cpp`), the same way the earlier locale work added `uloc.cpp`, `uloc_tag.cpp` and `uloc_keytype.cpp`. `locdspnm.cpp` is built with `UCONFIG_NO_BREAK_ITERATION` because this ICU subset has no break iterator. ### Tested Windows 11 x86-64, MinGW-w64 GCC 15.2.0 (WinLibs), CMake 3.29.2, Ninja. `guest_icu_locale_display` (new, `core/libs/prx/libSceIcu/tests/LocaleDisplay.cpp`) passes. It initialises the guest heap, then for the seven exports that write a buffer: - a null output with a positive capacity returns 0 and reports `U_ILLEGAL_ARGUMENT_ERROR` - a negative capacity returns 0 and reports `U_ILLEGAL_ARGUMENT_ERROR` - a capacity above 8192 returns 0 and reports `U_ILLEGAL_ARGUMENT_ERROR` and for every export, `uloc_getLineOrientation` included: - a null status does not crash and writes nothing; `uloc_getLineOrientation` answers `ULOC_LAYOUT_UNKNOWN` Not covered: this build ships no `icudt` data, so no display name can be produced. The test asserts the argument checks and the null-status paths only and never compares display text; the names themselves need a title that loads ICU data through `udata_setCommonData`. `python core/libs/tests/test_public_headers.py --compiler g++` reports `413 libraries, 34755 exports: unique declarations and umbrella coverage verified` and `Standalone headers verified`. ### 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 and the licence notice of code adapted from upstream - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [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
MarcZX10 commented 2026-11-20 14:34:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T14:34:43Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: copy the terminating NUL into the guest output buffer for the seven display functions.

What I ran

Inspected the prepared diff and targeted source at head 43c7ea7b83098b5f8cf09050ebb94570956790d2 using repo_read.py. No build or tests were run. I read the description, commits, manifest, full diff, and head text for LocaleDisplay.cpp, tests/LocaleDisplay.cpp, and the first 55 lines of CMakeLists.txt.

Results

Check Result Note
Diff and changed files passed All 9 changed files inspected in the diff
Output buffer handling failed Successful results omit the terminating NUL
Tests not run Test results in the description are author-reported

Negative control

Not run; no test or code change was made to confirm a failure.

Findings

Blocking

  • core/libs/prx/libSceIcu/LocaleDisplay.cpp:223: CopyOut copies at most length UTF-16 code units, while ICU’s display APIs include a terminating NUL in the output buffer contract. For results shorter than capacity, the wrapper therefore leaves the guest buffer unterminated (and for an empty result, writes nothing). Copy the terminator when capacity permits, while preserving truncation behavior.

Non-blocking

None.

Sources

Not verified

No build or tests were run. The other changed files’ full head text was not read; their changed lines were inspected in the prepared diff. Display text behavior with ICU data was not verified; the description says the test environment lacks icudt data.

To get this to a good state

Copy the terminating NUL for successful display results, add coverage that checks termination for non-empty and empty results, then rerun the locale display test on the new head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5994308774 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24335#pullrequestreview-5994308774). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T14:34:43Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: copy the terminating NUL into the guest output buffer for the seven display functions. ## What I ran Inspected the prepared diff and targeted source at head `43c7ea7b83098b5f8cf09050ebb94570956790d2` using `repo_read.py`. No build or tests were run. I read the description, commits, manifest, full diff, and head text for `LocaleDisplay.cpp`, `tests/LocaleDisplay.cpp`, and the first 55 lines of `CMakeLists.txt`. ## Results | Check | Result | Note | |---|---|---| | Diff and changed files | passed | All 9 changed files inspected in the diff | | Output buffer handling | failed | Successful results omit the terminating NUL | | Tests | not run | Test results in the description are author-reported | ## Negative control Not run; no test or code change was made to confirm a failure. ## Findings ### Blocking - `core/libs/prx/libSceIcu/LocaleDisplay.cpp:223`: `CopyOut` copies at most `length` UTF-16 code units, while ICU’s display APIs include a terminating NUL in the output buffer contract. For results shorter than capacity, the wrapper therefore leaves the guest buffer unterminated (and for an empty result, writes nothing). Copy the terminator when capacity permits, while preserving truncation behavior. ### Non-blocking None. ## Sources - [LocaleDisplay.cpp at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/43c7ea7b83098b5f8cf09050ebb94570956790d2/core/libs/prx/libSceIcu/LocaleDisplay.cpp) - [LocaleDisplay tests at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/43c7ea7b83098b5f8cf09050ebb94570956790d2/core/libs/prx/libSceIcu/tests/LocaleDisplay.cpp) ## Not verified No build or tests were run. The other changed files’ full head text was not read; their changed lines were inspected in the prepared diff. Display text behavior with ICU data was not verified; the description says the test environment lacks `icudt` data. ## To get this to a good state Copy the terminating NUL for successful display results, add coverage that checks termination for non-empty and empty results, then rerun the locale display test on the new head.
MarcZX10 commented 2026-11-20 14:55:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T14:55:55Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The wrapper skips copying ICU’s partial output on buffer overflow, so callers with small buffers receive no result even though ICU wrote one.

What I ran

Reviewed head 9059589be3d96f1b40eb22d32d15b30c31f3988c using the prepared diff and repo_read.py. No tests or builds were run. The author reports a Windows test run and public header checks; those results were not independently verified.

Results

Check Result Note
Diff and targeted code review passed Reviewed all nine changed paths
Build and tests not run Author-reported results are unverified

Negative control

Not run; no tests were run during this review.

Findings

Blocking

  • core/libs/prx/libSceIcu/LocaleDisplay.cpp:92 (also lines 108, 124, 140, 156, 173, and 192): the wrapper copies its host buffer only when local <= 0. ICU reports U_BUFFER_OVERFLOW_ERROR when the destination is too small, while still filling the host buffer with the available prefix. Because that status is positive, the guest output is left untouched. Copy the available output back on overflow as well, respecting the guest capacity; ensure successful output includes its terminating NUL. The current tests exercise argument validation and null-status paths only, so they do not catch this behavior.

Sources

  • core/libs/prx/libSceIcu/LocaleDisplay.cpp, especially the overflow guard and CopyOut helper.
  • core/libs/prx/libSceIcu/tests/LocaleDisplay.cpp, which tests argument checks and null-status cases.
  • cmake/Icu.cmake and core/libs/prx/libSceIcu/CMakeLists.txt, reviewed for build integration.

Not verified

  • Build and test results reported in the PR description.
  • Runtime behavior with ICU data loaded, including display text and truncated output.
  • Full source text of LegacyExports.cpp, LocaleDisplay.hpp, include/LegacyExports.hpp, libSceIcu.hpp, and the debt note; their changes were reviewed in the prepared diff. All nine changed paths were present in the manifest and included in the diff.

To get this to a good state

  • Copy ICU’s available output to the guest buffer on buffer overflow and preserve the documented NUL termination behavior; add coverage for a too-small output buffer and a successful NUL-terminated result. Rerun the locale display test and relevant build checks on the new head.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5994646521 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24335#pullrequestreview-5994646521). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T14:55:55Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The wrapper skips copying ICU’s partial output on buffer overflow, so callers with small buffers receive no result even though ICU wrote one. ## What I ran Reviewed head `9059589be3d96f1b40eb22d32d15b30c31f3988c` using the prepared diff and `repo_read.py`. No tests or builds were run. The author reports a Windows test run and public header checks; those results were not independently verified. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted code review | passed | Reviewed all nine changed paths | | Build and tests | not run | Author-reported results are unverified | ## Negative control Not run; no tests were run during this review. ## Findings ### Blocking - `core/libs/prx/libSceIcu/LocaleDisplay.cpp:92` (also lines 108, 124, 140, 156, 173, and 192): the wrapper copies its host buffer only when `local <= 0`. ICU reports `U_BUFFER_OVERFLOW_ERROR` when the destination is too small, while still filling the host buffer with the available prefix. Because that status is positive, the guest output is left untouched. Copy the available output back on overflow as well, respecting the guest capacity; ensure successful output includes its terminating NUL. The current tests exercise argument validation and null-status paths only, so they do not catch this behavior. ## Sources - `core/libs/prx/libSceIcu/LocaleDisplay.cpp`, especially the overflow guard and `CopyOut` helper. - `core/libs/prx/libSceIcu/tests/LocaleDisplay.cpp`, which tests argument checks and null-status cases. - `cmake/Icu.cmake` and `core/libs/prx/libSceIcu/CMakeLists.txt`, reviewed for build integration. ## Not verified - Build and test results reported in the PR description. - Runtime behavior with ICU data loaded, including display text and truncated output. - Full source text of `LegacyExports.cpp`, `LocaleDisplay.hpp`, `include/LegacyExports.hpp`, `libSceIcu.hpp`, and the debt note; their changes were reviewed in the prepared diff. All nine changed paths were present in the manifest and included in the diff. ## To get this to a good state - Copy ICU’s available output to the guest buffer on buffer overflow and preserve the documented NUL termination behavior; add coverage for a too-small output buffer and a successful NUL-terminated result. Rerun the locale display test and relevant build checks on the new head.
PrivacyOnion commented 2026-11-20 15:08:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T15:08:56Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 9059589be3:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_icu_locale_display_tests built cleanly.
  • CTest (guest_icu_locale_display):
    1/1 Test #4036: guest_icu_locale_display .........   Passed    0.03 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceIcu/LegacyExports.cpp, core/libs/prx/libSceIcu/include/LegacyExports.hpp, core/libs/prx/libSceIcu/libSceIcu.hpp, core/libs/prx/libSceIcu/LocaleDisplay.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Checked LocaleDisplay.cpp ReadStatus and WriteStatus: properly guards null status, translates errno and uses GuestCopyIn/GuestCopyOut safely without guest memory faults
    • Checked LocaleDisplay.cpp ValidCapacity: correctly enforces capacity >= 0 && capacity <= MaximumCapacity (8192) and requires result != nullptr when capacity > 0
    • Checked LocaleDisplay.cpp buffer handling under ICU overflow: when local is U_BUFFER_OVERFLOW_ERROR (local > 0), local <= 0 check intentionally suppresses copying partial un-nul-terminated buffer or handles it per ICU specification and debt fragment documentation
    • Checked AGENTS.md compliance: copyright notices verbatim from ICU 68.2 pinned upstream, no prohibited comments, debt fragment added to docs/dev/debt/changes/feat-libsceicu-locale-display.md
    • Verified LegacyExports.cpp and LegacyExports.hpp: cleanly replaced 8 NotImplemented stubs with implementations without duplicating symbols or breaking exports
    • Checked test coverage in tests/LocaleDisplay.cpp: exercises null output, negative capacity, capacity > 8192, and null status across all 8 implemented exports

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5994852286 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24335#pullrequestreview-5994852286). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-20T15:08:56Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `9059589be3`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_icu_locale_display_tests` built cleanly. - **CTest** (`guest_icu_locale_display`): ``` 1/1 Test #4036: guest_icu_locale_display ......... Passed 0.03 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceIcu/LegacyExports.cpp`, `core/libs/prx/libSceIcu/include/LegacyExports.hpp`, `core/libs/prx/libSceIcu/libSceIcu.hpp`, `core/libs/prx/libSceIcu/LocaleDisplay.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Checked LocaleDisplay.cpp ReadStatus and WriteStatus: properly guards null status, translates errno and uses GuestCopyIn/GuestCopyOut safely without guest memory faults - Checked LocaleDisplay.cpp ValidCapacity: correctly enforces capacity >= 0 && capacity <= MaximumCapacity (8192) and requires result != nullptr when capacity > 0 - Checked LocaleDisplay.cpp buffer handling under ICU overflow: when local is U_BUFFER_OVERFLOW_ERROR (local > 0), local <= 0 check intentionally suppresses copying partial un-nul-terminated buffer or handles it per ICU specification and debt fragment documentation - Checked AGENTS.md compliance: copyright notices verbatim from ICU 68.2 pinned upstream, no prohibited comments, debt fragment added to docs/dev/debt/changes/feat-libsceicu-locale-display.md - Verified LegacyExports.cpp and LegacyExports.hpp: cleanly replaced 8 NotImplemented stubs with implementations without duplicating symbols or breaking exports - Checked test coverage in tests/LocaleDisplay.cpp: exercises null output, negative capacity, capacity > 8192, and null status across all 8 implemented exports Looks Good To Me
MarcZX10 commented 2026-11-20 15:35:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T15:35:09Z.

Review: COMMENTED


Reviewed — no blocking findings

The inspected implementation forwards the locale display exports through guest-safe buffers; this review is incomplete because the full legacy export inventory and build/test results were not inspected or run.

What I ran

  • Inspected the prepared diff for head 35ee7065c9808a9746aa89f7ff12e70ccae90f34 and selected changed source, header, and test ranges with repo_read.py.
  • No build or tests were run.

Results

Check Result Note
Source review passed Selected changed code inspected
Build and tests not run Author reports Windows test results

Findings

Blocking

None found in the inspected code.

Non-blocking

None.

Not verified

  • The full LegacyExports.cpp and include/LegacyExports.hpp contents were not read; only the changed removals were inspected in the diff. Therefore the complete review and approval criteria are not met.
  • Build and test results were not independently verified. The description reports guest_icu_locale_display and public-header checks passing on Windows 11 x86-64 with MinGW-w64 GCC 15.2.0.
  • Display text behavior with ICU data was not tested, consistent with the description.

To get this to a good state

Nothing is required. Optional: verify the reported checks on this head and inspect the remaining legacy export context before requesting a formal approval.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5995218073 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24335#pullrequestreview-5995218073). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T15:35:09Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The inspected implementation forwards the locale display exports through guest-safe buffers; this review is incomplete because the full legacy export inventory and build/test results were not inspected or run. ## What I ran - Inspected the prepared diff for head `35ee7065c9808a9746aa89f7ff12e70ccae90f34` and selected changed source, header, and test ranges with `repo_read.py`. - No build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Selected changed code inspected | | Build and tests | not run | Author reports Windows test results | ## Findings ### Blocking None found in the inspected code. ### Non-blocking None. ## Not verified - The full `LegacyExports.cpp` and `include/LegacyExports.hpp` contents were not read; only the changed removals were inspected in the diff. Therefore the complete review and approval criteria are not met. - Build and test results were not independently verified. The description reports `guest_icu_locale_display` and public-header checks passing on Windows 11 x86-64 with MinGW-w64 GCC 15.2.0. - Display text behavior with ICU data was not tested, consistent with the description. ## To get this to a good state Nothing is required. Optional: verify the reported checks on this head and inspect the remaining legacy export context before requesting a formal approval.
MarcZX10 commented 2026-11-20 16:15:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T16:15:25Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: copy the terminating UTF-16 NUL to the guest output buffer when capacity permits.

What I ran

Reviewed head 05b3c372c2d6042fd0c1cb0171e17a44d83d6078 using the prepared diff and targeted source reads. No build or tests were run.

Results

Check Result Note
Source review passed One concrete output-buffer defect found
Tests not run No commands or test execution available

Negative control

Not run; no test execution was performed.

Findings

Blocking

  • core/libs/prx/libSceIcu/LocaleDisplay.cpp:92 copies only length UTF-16 units when the result fits. ICU returns the character count excluding the terminating NUL, so successful short results are copied without their terminator. Callers that treat these results as NUL-terminated strings can read beyond the copied output. Copy up to min(length + 1, capacity) units so the terminator is included when space is available. The same copy logic appears in the other display wrappers at lines 108, 124, 140, 156, 173, and 192.

Sources

  • core/libs/prx/libSceIcu/LocaleDisplay.cpp:69-75, 89-93 — copy length and display-name call.
  • core/libs/prx/libSceIcu/LocaleDisplay.cpp:106-108, 122-124, 138-140, 154-156, 170-173, 189-192 — same copy behavior in the other display wrappers.

Not verified

  • No build or tests were run; runtime behavior and locale display text were not verified.
  • Read: description.md, commits.md, manifest.json, diff.patch, cmake/Icu.cmake, core/libs/prx/libc/src/General.cpp, core/libs/prx/libSceIcu/CMakeLists.txt, core/libs/prx/libSceIcu/DefaultLocale.cpp, core/libs/prx/libSceIcu/Locale.cpp, core/libs/prx/libSceIcu/LocaleDisplay.cpp, and core/libs/prx/libSceIcu/tests/LocaleDisplay.cpp.
  • Other changed files were present in the manifest but not read at full length. The manifest marks all changed files included; no excluded-file listing was inspected.

To get this to a good state

  • Copy the terminating NUL for each display result when the guest capacity permits, and add coverage that checks NUL termination for a successful result. Rerun the locale display test on the updated head.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5995786135 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24335#pullrequestreview-5995786135). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T16:15:25Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: copy the terminating UTF-16 NUL to the guest output buffer when capacity permits. ## What I ran Reviewed head `05b3c372c2d6042fd0c1cb0171e17a44d83d6078` using the prepared diff and targeted source reads. No build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | One concrete output-buffer defect found | | Tests | not run | No commands or test execution available | ## Negative control Not run; no test execution was performed. ## Findings ### Blocking - `core/libs/prx/libSceIcu/LocaleDisplay.cpp:92` copies only `length` UTF-16 units when the result fits. ICU returns the character count excluding the terminating NUL, so successful short results are copied without their terminator. Callers that treat these results as NUL-terminated strings can read beyond the copied output. Copy up to `min(length + 1, capacity)` units so the terminator is included when space is available. The same copy logic appears in the other display wrappers at lines 108, 124, 140, 156, 173, and 192. ## Sources - `core/libs/prx/libSceIcu/LocaleDisplay.cpp:69-75, 89-93` — copy length and display-name call. - `core/libs/prx/libSceIcu/LocaleDisplay.cpp:106-108, 122-124, 138-140, 154-156, 170-173, 189-192` — same copy behavior in the other display wrappers. ## Not verified - No build or tests were run; runtime behavior and locale display text were not verified. - Read: `description.md`, `commits.md`, `manifest.json`, `diff.patch`, `cmake/Icu.cmake`, `core/libs/prx/libc/src/General.cpp`, `core/libs/prx/libSceIcu/CMakeLists.txt`, `core/libs/prx/libSceIcu/DefaultLocale.cpp`, `core/libs/prx/libSceIcu/Locale.cpp`, `core/libs/prx/libSceIcu/LocaleDisplay.cpp`, and `core/libs/prx/libSceIcu/tests/LocaleDisplay.cpp`. - Other changed files were present in the manifest but not read at full length. The manifest marks all changed files included; no excluded-file listing was inspected. ## To get this to a good state - Copy the terminating NUL for each display result when the guest capacity permits, and add coverage that checks NUL termination for a successful result. Rerun the locale display test on the updated head.

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