feat(libSceIcu): implement UTF-16 copy and concatenation #10964

Merged
AZLisme merged 5 commits from upstream-pr/10964 into main 2026-11-13 06:01:10 +00:00
AZLisme commented 2026-10-25 11:22:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AZLisme on 2026-10-25T11:22:11Z.


What

Rebased onto frozen main 6e9b9134f6ed14e659d870a33118d164096551df, which includes the actual merge of #11760. Preserve its 112 throwing sceIcuUnknown_*_nid_no_patch exports and ABI-unverified debt together with the existing invariant/version and unescape implementation. The owned implementation, public declarations and fixtures remain byte-identical to the previous published head 216b1118cd1ddffa68dc67948a856ef286e4d142; the debt conflict is resolved without including another open ICU topic.

Implement u_strcpy, u_strncpy, u_strcat, u_strncat and u_memcpy using ICU 78.1 semantics and public ABI. Preserve raw UTF-16 code units, return pointers, nonpositive-count shortcuts, bounded-copy NUL behavior without padding and the reference implementation's bounded-concatenation terminator. Canonical declarations are in Copy.hpp, reachable through libSceIcu.hpp.

Checked HostWrite scopes cover only actual writes: bounded-copy unused capacity stays unopened and concatenation opens only the appended suffix. Rejected scopes throw before stores. Preserve main's invariant/version and merged #10961 unescape sources, declarations, fixtures and debt. The owned implementation, header and both fixtures are byte-identical to 3750dc2ddb7cc9e45703e29b467b2eff4eedc06a; shared registrations and includes are reconciled. #10963 remains the open immediate predecessor.

The agreed landing order remains #11013 → #10961 → #10962 → #10963 → #10964 → #10965 → #10966 → #10967 → #11088. #11013 and #10961 have merged; the other open topics are not included or marked fulfilled by this independent branch.

Tested

2026-11-01 Windows CI: run 41295116341, 706c0fb6ed694244f507528b9e5c24364fe41932 + main 26fa1212b82f76dd49cf12d65e445d6ff3e0844c: 1,680 selected CTests passed, 904 skipped, zero failed. All 10 ICU cases passed, including guest_icu_copy, guest_icu_copy_guest_memory. The production ICU module built, linked and was NID-patched. This is the fixed single-PR integration, not the six-topic Windows union. General full-suite, skip-audit and header CTests were not run; native ABI/context/unload, existing dependencies, CI and review gates remain.

2026-11-01: preserving rebase 706c0fb6ed694244f507528b9e5c24364fe41932 onto fixed main 26fa1212b82f76dd49cf12d65e445d6ff3e0844c. Linux GCC 16.2.1 Release: baseline 61 plain + 4 logging-enabled runtime CTests; private SIG-plus-six-ICU union 4908848dab02fb1f0a9fad7e9525ddb8a628177a 71 + 6. All passed, with 65 public-header tests per side. Relevant: guest_icu_copy, guest_icu_copy_guest_memory. Scope is this fixed baseline/private composition; bare heads, later main, Windows, native ABI and unloading remain unqualified. Earlier results retain their original scope.

2026-10-30 fresh Linux integration check on fixed main 0362b1521c4ee08eeeccc2f98e9987e36fca9ea1: a separate private candidate 8a5c8c499f0e0a157bd110430c1d99ee73bb0d47 (tree 620649fa8b0512d9c7e114c670342a691fd1433a) combines #10953 at 581d45c282371af828efec2a8cec6f43beacc68a with the same six unchanged published ICU heads recorded in the earlier converter-callback integration update. No public branch was rebased by this check.

Fresh native Linux x86-64 Release builds passed 53/53 selected plain runtime CTests on that main baseline and 63/63 on the private candidate. With ANYPS5_LOG_FILE set before process startup, another 4/4 baseline and 6/6 candidate runtime executions passed. Together these are 126 runtime CTest executions; both lanes also passed 65/65 public-header checks, 130 header executions total, with zero failed, skipped or Not Run rows. The candidate ran all 13 registered ICU fixtures, including both guest-memory protection fixtures; converter callbacks ran in both lanes. The selected integration set also exercises logging, heap/allocator, signal, exception and thread behavior.

Production NID patching and readelf/nm inspection found the baseline’s four converter-callback NIDs and all 39 targeted candidate NIDs; this is artifact evidence, not patched-loader functional coverage. Twelve separately observed controlled std::abort child runs returned the expected exit 3; they are not additional CTests or proof of native signal-context behavior. Source and dependency identities were checked before and after execution.

These results apply only to the fixed baseline and private SIG-plus-six-ICU candidate. They add no bare-public-head, later-main, Windows, native-ABI, full-suite, GPU or unload qualification. Earlier results keep their original inputs and scope. The existing predecessor, preserving-rebase, maintainer CI and review requirements and agreed ICU landing order still apply.

2026-10-30 converter-callback integration update: #12692 actually merged as 91a69952c100 (topic 207ac4b5ecfe). Against pinned main 08a10d225306ad102b57408e2ef7566bcfb829b2, all six published ICU heads remain independently clean to integrate; this source review found no duplicate implementation, new dependency or individually required rebase. A separate private all-six union, 6e174798251592474dd94c61975655b409b9c2e9 (tree 446a6e346d3c6fac2e19e358d4376376778c7ae9), preserves 35 owned helpers, the four landed converter callbacks and 13 source-registered ICU fixtures through routine shared-file resolutions; the 98 unknown stubs remain unchanged.

Exact published inputs: #10962 bbccec1140eeccb5adf61f7c497791b183c1bf93, #10963 28cc96f3be1e16d2e3f098b0ae5b77b4fea85e09, #10964 4360e8f85b0bbd184199d9a3822dc30a8bd5f81e, #10965 c2076fe30ee3442546af395930defd74b7bfac2a, #10966 491e27444d83b53bc215a94edf132aee6a4707d7, #10967 babf2bc72012bd926f35408b3d602d162a5ecd1b.

Fresh native Linux x86-64 Release, GCC 16.2.1: the pinned08a main baseline passed 18/18 selected runtime cases and 65/65 public-header checks; the exact private all-six union passed 26/26 runtime cases and 65/65 headers, with zero failures, skips or Not Run rows. The union executed all 13 ICU fixtures, including guest_icu_copy_guest_memory and guest_icu_utf_memory, alongside 13 heap/allocator cases; the converter-callback fixture passed in both lanes. Production NID patching plus readelf/nm inspection verified the four callback NIDs in the baseline and all 39 targeted NIDs in the union (35 owned helpers plus four callbacks). This last check is artifact inspection, not patched-module loader runtime or native-ABI proof.

These results cover only that fixed baseline and private all-six union, not any bare published head, later main, Windows/native ABI, all-nine integration, full suite, title or GPU behavior. Earlier main750 and other historical results retain their original inputs and scope. The declared order remains #10962, #10963, #10964, #10965, #10966, #10967, then #11088; the already merged #12692 adds no new prerequisite. Actual #10963 merge must come first, followed by a preserving rebase, fresh integration checks and re-review before this PR lands.

Current exact-head native Windows validation: run 40621182257, attempt 1 tested 4360e8f85b0bbd184199d9a3822dc30a8bd5f81e independently on its frozen main 6e9b9134f6ed14e659d870a33118d164096551df. Windows x86-64, GitHub-hosted win25-vs2026 image 20261021.278.1 (OS build 10.0.26100.33650), verified WinLibs GCC 15.2.0 r7/UCRT, normal-root Release, BUILD_TESTING=ON. guest_icu_version, guest_icu_unescape, guest_icu_copy, guest_icu_copy_guest_memory passed 4/4, and all 65/65 normal public-header CTests passed once, with zero failures or skipped cases. Each lane used a separate fresh build without object or compiler-cache reuse. The separate bare-main control passed its two existing ICU fixtures and 65 header checks.

The unchanged guest-memory fixture executed Windows positive-count read-only rejection checks and reported guest-mapped copy and readonly no-op checks passed; write-watch verified. The unavailable branch was absent from the actual JUnit, LastTest and verbose logs. Native preprocessing retained _WIN32 and the original aborting Require checks under Release; no fixture or product source was changed. Complete recursive source/submodule identity was checked before and after execution. Actual executable/provider payloads, PE imports, compile commands and raw CTest logs are archived with the run. Provider resolution is inferred from the normal import chain and absolute command/PATH staging; no loaded-module trace was captured.

This is focused standalone Windows component/header evidence. macOS, physical PS5, sanitizer, full-product CI and later-main integration are not covered by this run. The existing review, applicable full maintainer CI and agreed actual-predecessor/landing-order gates remain.

Current exact-head validation: 4360e8f85b0bbd184199d9a3822dc30a8bd5f81e on frozen main 6e9b9134f6ed14e659d870a33118d164096551df: Linux x86-64, normal-root Release, BUILD_TESTING=ON. guest_icu_version, guest_icu_unescape, guest_icu_copy, guest_icu_copy_guest_memory passed 4/4; all 65/65 normal public-header CTests passed, with no failed or skipped CTest cases. The complete ICU provider and registered fixtures were built for this standalone branch. The common core was freshly built from this main once; this lane retained 190 objects only after matching their exact compiler commands, complete observed input hashes and object digests, and rebuilt or added 8 objects. Source identity before/after testing and the actual fixture/provider paths were verified. Conventions, whitespace and source-preservation checks pass.

The guest-memory fixture reported write-watch unavailable on this Linux host. Guest-mapped copies and read-only no-op checks ran; native write-watch and Windows-only positive-count read-only rejection subcases were not covered.

These results cover this standalone Linux component/header build. New-head macOS, PS5, sanitizer and full-product CI remain untested here; historical platform and private-composition evidence retains its recorded source scope. The declared predecessor and agreed ICU landing order remain required.

Historical validation before this rebase

Historical candidate 216b1118cd1ddffa68dc67948a856ef286e4d142 on frozen main aebeaa53f54dd4eccfe313f147807e3434588404: Linux x86-64, GNU 16.2.1, Release, BUILD_TESTING=ON. Fresh normal-root builds compiled the required libc/kernel runtime, complete ICU module and all registered ICU fixtures. guest_icu_version, guest_icu_unescape, guest_icu_copy, guest_icu_copy_guest_memory passed 4/4, with zero failures or skips. All 65/65 normal public-header CTests passed: declaration audit plus 64 compilation shards, covering 699 groups, 368 libraries and 12,814 exports. Conventions, whitespace and source-preservation checks passed.

This is an independent branch validation, with 197 fresh compiled objects and actual input/artifact/provider-path checks; no old core, module or fixture binaries were transferred. Existing repository-pinned prebuilt FFmpeg was used only for normal configuration and is absent from the ICU compile/link closure. No new Windows, macOS, PS5, sanitizer, GPU, full-product or remaining-series integration result is claimed; Windows-only HostWrite-refusal cases were not executed here.

Historical evidence remains source-bound: 3750dc2ddb7cc9e45703e29b467b2eff4eedc06a on 6733079b2d01bb25aa1e6e771680da6a17363e3b passed 3/3 Linux fixtures and five header units. wachi35676 reported Windows runs of 0b58809a25 merged onto 14eb2cda22. Those runs and archived private ICU compositions do not qualify this rebase.

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: #10963
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5004253439 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10964). Originally posted by [AZLisme](https://github.com/AZLisme) on 2026-10-25T11:22:11Z. --- ### What Rebased onto frozen main `6e9b9134f6ed14e659d870a33118d164096551df`, which includes the actual merge of #11760. Preserve its 112 throwing `sceIcuUnknown_*_nid_no_patch` exports and ABI-unverified debt together with the existing invariant/version and unescape implementation. The owned implementation, public declarations and fixtures remain byte-identical to the previous published head `216b1118cd1ddffa68dc67948a856ef286e4d142`; the debt conflict is resolved without including another open ICU topic. Implement `u_strcpy`, `u_strncpy`, `u_strcat`, `u_strncat` and `u_memcpy` using [ICU 78.1 semantics and public ABI](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/ustring.cpp). Preserve raw UTF-16 code units, return pointers, nonpositive-count shortcuts, bounded-copy NUL behavior without padding and the reference implementation's bounded-concatenation terminator. Canonical declarations are in `Copy.hpp`, reachable through `libSceIcu.hpp`. Checked `HostWrite` scopes cover only actual writes: bounded-copy unused capacity stays unopened and concatenation opens only the appended suffix. Rejected scopes throw before stores. Preserve main's invariant/version and merged #10961 unescape sources, declarations, fixtures and debt. The owned implementation, header and both fixtures are byte-identical to `3750dc2ddb7cc9e45703e29b467b2eff4eedc06a`; shared registrations and includes are reconciled. #10963 remains the open immediate predecessor. The [agreed landing order](https://github.com/boykopovar/AnyPS5/pull/11088#issuecomment-6401505606) remains #11013 → #10961 → #10962 → #10963 → #10964 → #10965 → #10966 → #10967 → #11088. #11013 and #10961 have merged; the other open topics are not included or marked fulfilled by this independent branch. ### Tested 2026-11-01 Windows CI: [run 41295116341](https://github.com/boykopovar/AnyPS5/actions/runs/41295116341), `706c0fb6ed694244f507528b9e5c24364fe41932` + main `26fa1212b82f76dd49cf12d65e445d6ff3e0844c`: 1,680 selected CTests passed, 904 skipped, zero failed. All 10 ICU cases passed, including `guest_icu_copy`, `guest_icu_copy_guest_memory`. The production ICU module built, linked and was NID-patched. This is the fixed single-PR integration, not the six-topic Windows union. General full-suite, skip-audit and header CTests were not run; native ABI/context/unload, existing dependencies, CI and review gates remain. 2026-11-01: preserving rebase `706c0fb6ed694244f507528b9e5c24364fe41932` onto fixed main `26fa1212b82f76dd49cf12d65e445d6ff3e0844c`. Linux GCC 16.2.1 Release: baseline 61 plain + 4 logging-enabled runtime CTests; private SIG-plus-six-ICU union `4908848dab02fb1f0a9fad7e9525ddb8a628177a` 71 + 6. All passed, with 65 public-header tests per side. Relevant: `guest_icu_copy`, `guest_icu_copy_guest_memory`. Scope is this fixed baseline/private composition; bare heads, later main, Windows, native ABI and unloading remain unqualified. Earlier results retain their original scope. 2026-10-30 fresh Linux integration check on fixed main `0362b1521c4ee08eeeccc2f98e9987e36fca9ea1`: a separate private candidate `8a5c8c499f0e0a157bd110430c1d99ee73bb0d47` (tree `620649fa8b0512d9c7e114c670342a691fd1433a`) combines #10953 at `581d45c282371af828efec2a8cec6f43beacc68a` with the same six unchanged published ICU heads recorded in the earlier converter-callback integration update. No public branch was rebased by this check. Fresh native Linux x86-64 Release builds passed 53/53 selected plain runtime CTests on that main baseline and 63/63 on the private candidate. With `ANYPS5_LOG_FILE` set before process startup, another 4/4 baseline and 6/6 candidate runtime executions passed. Together these are 126 runtime CTest executions; both lanes also passed 65/65 public-header checks, 130 header executions total, with zero failed, skipped or Not Run rows. The candidate ran all 13 registered ICU fixtures, including both guest-memory protection fixtures; converter callbacks ran in both lanes. The selected integration set also exercises logging, heap/allocator, signal, exception and thread behavior. Production NID patching and `readelf`/`nm` inspection found the baseline’s four converter-callback NIDs and all 39 targeted candidate NIDs; this is artifact evidence, not patched-loader functional coverage. Twelve separately observed controlled `std::abort` child runs returned the expected exit 3; they are not additional CTests or proof of native signal-context behavior. Source and dependency identities were checked before and after execution. These results apply only to the fixed baseline and private SIG-plus-six-ICU candidate. They add no bare-public-head, later-main, Windows, native-ABI, full-suite, GPU or unload qualification. Earlier results keep their original inputs and scope. The existing predecessor, preserving-rebase, maintainer CI and review requirements and agreed ICU landing order still apply. 2026-10-30 converter-callback integration update: #12692 actually merged as `91a69952c100` (topic `207ac4b5ecfe`). Against pinned main `08a10d225306ad102b57408e2ef7566bcfb829b2`, all six published ICU heads remain independently clean to integrate; this source review found no duplicate implementation, new dependency or individually required rebase. A separate private all-six union, `6e174798251592474dd94c61975655b409b9c2e9` (tree `446a6e346d3c6fac2e19e358d4376376778c7ae9`), preserves 35 owned helpers, the four landed converter callbacks and 13 source-registered ICU fixtures through routine shared-file resolutions; the 98 unknown stubs remain unchanged. Exact published inputs: #10962 `bbccec1140eeccb5adf61f7c497791b183c1bf93`, #10963 `28cc96f3be1e16d2e3f098b0ae5b77b4fea85e09`, #10964 `4360e8f85b0bbd184199d9a3822dc30a8bd5f81e`, #10965 `c2076fe30ee3442546af395930defd74b7bfac2a`, #10966 `491e27444d83b53bc215a94edf132aee6a4707d7`, #10967 `babf2bc72012bd926f35408b3d602d162a5ecd1b`. Fresh native Linux x86-64 Release, GCC 16.2.1: the pinned08a main baseline passed 18/18 selected runtime cases and 65/65 public-header checks; the exact private all-six union passed 26/26 runtime cases and 65/65 headers, with zero failures, skips or Not Run rows. The union executed all 13 ICU fixtures, including `guest_icu_copy_guest_memory` and `guest_icu_utf_memory`, alongside 13 heap/allocator cases; the converter-callback fixture passed in both lanes. Production NID patching plus `readelf`/`nm` inspection verified the four callback NIDs in the baseline and all 39 targeted NIDs in the union (35 owned helpers plus four callbacks). This last check is artifact inspection, not patched-module loader runtime or native-ABI proof. These results cover only that fixed baseline and private all-six union, not any bare published head, later main, Windows/native ABI, all-nine integration, full suite, title or GPU behavior. Earlier main750 and other historical results retain their original inputs and scope. The declared order remains #10962, #10963, #10964, #10965, #10966, #10967, then #11088; the already merged #12692 adds no new prerequisite. Actual #10963 merge must come first, followed by a preserving rebase, fresh integration checks and re-review before this PR lands. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> **Current exact-head native Windows validation:** [run 40621182257, attempt 1](https://github.com/AZLisme/AnyPS5/actions/runs/40621182257/job/122595338711) tested `4360e8f85b0bbd184199d9a3822dc30a8bd5f81e` independently on its frozen main `6e9b9134f6ed14e659d870a33118d164096551df`. Windows x86-64, GitHub-hosted `win25-vs2026` image `20261021.278.1` (OS build `10.0.26100.33650`), verified WinLibs GCC 15.2.0 r7/UCRT, normal-root Release, `BUILD_TESTING=ON`. `guest_icu_version`, `guest_icu_unescape`, `guest_icu_copy`, `guest_icu_copy_guest_memory` passed **4/4**, and all **65/65** normal public-header CTests passed once, with zero failures or skipped cases. Each lane used a separate fresh build without object or compiler-cache reuse. The separate bare-main control passed its two existing ICU fixtures and 65 header checks. The unchanged guest-memory fixture executed Windows positive-count read-only rejection checks and reported `guest-mapped copy and readonly no-op checks passed; write-watch verified`. The unavailable branch was absent from the actual JUnit, LastTest and verbose logs. Native preprocessing retained `_WIN32` and the original aborting `Require` checks under Release; no fixture or product source was changed. Complete recursive source/submodule identity was checked before and after execution. Actual executable/provider payloads, PE imports, compile commands and raw CTest logs are archived with the run. Provider resolution is inferred from the normal import chain and absolute command/PATH staging; no loaded-module trace was captured. This is focused standalone Windows component/header evidence. macOS, physical PS5, sanitizer, full-product CI and later-main integration are not covered by this run. The existing review, applicable full maintainer CI and agreed actual-predecessor/landing-order gates remain. **Current exact-head validation:** `4360e8f85b0bbd184199d9a3822dc30a8bd5f81e` on frozen main `6e9b9134f6ed14e659d870a33118d164096551df`: Linux x86-64, normal-root Release, `BUILD_TESTING=ON`. `guest_icu_version`, `guest_icu_unescape`, `guest_icu_copy`, `guest_icu_copy_guest_memory` passed **4/4**; all **65/65** normal public-header CTests passed, with no failed or skipped CTest cases. The complete ICU provider and registered fixtures were built for this standalone branch. The common core was freshly built from this main once; this lane retained 190 objects only after matching their exact compiler commands, complete observed input hashes and object digests, and rebuilt or added 8 objects. Source identity before/after testing and the actual fixture/provider paths were verified. Conventions, whitespace and source-preservation checks pass. The guest-memory fixture reported write-watch unavailable on this Linux host. Guest-mapped copies and read-only no-op checks ran; native write-watch and Windows-only positive-count read-only rejection subcases were not covered. These results cover this standalone Linux component/header build. New-head macOS, PS5, sanitizer and full-product CI remain untested here; historical platform and private-composition evidence retains its recorded source scope. The declared predecessor and agreed ICU landing order remain required. #### Historical validation before this rebase Historical candidate `216b1118cd1ddffa68dc67948a856ef286e4d142` on frozen main `aebeaa53f54dd4eccfe313f147807e3434588404`: Linux x86-64, GNU 16.2.1, Release, `BUILD_TESTING=ON`. Fresh normal-root builds compiled the required libc/kernel runtime, complete ICU module and all registered ICU fixtures. `guest_icu_version`, `guest_icu_unescape`, `guest_icu_copy`, `guest_icu_copy_guest_memory` passed **4/4**, with zero failures or skips. All **65/65** normal public-header CTests passed: declaration audit plus 64 compilation shards, covering 699 groups, 368 libraries and 12,814 exports. Conventions, whitespace and source-preservation checks passed. This is an independent branch validation, with 197 fresh compiled objects and actual input/artifact/provider-path checks; no old core, module or fixture binaries were transferred. Existing repository-pinned prebuilt FFmpeg was used only for normal configuration and is absent from the ICU compile/link closure. No new Windows, macOS, PS5, sanitizer, GPU, full-product or remaining-series integration result is claimed; Windows-only HostWrite-refusal cases were not executed here. Historical evidence remains source-bound: `3750dc2ddb7cc9e45703e29b467b2eff4eedc06a` on `6733079b2d01bb25aa1e6e771680da6a17363e3b` passed 3/3 Linux fixtures and five header units. [wachi35676 reported Windows runs of `0b58809a25` merged onto `14eb2cda22`](https://github.com/boykopovar/AnyPS5/pull/10964#issuecomment-6407509340). Those runs and archived private ICU compositions do not qualify this rebase. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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: <!-- #PR, or none --> #10963 - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes
MarcZX10 commented 2026-10-25 11:33:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T11:33:58Z.

Review: CHANGES_REQUESTED


The four string-writing functions (u_strcpy, u_strncpy, u_strcat, and u_strncat) write directly through guest pointers without opening a GuestArena::HostWrite scope. The u_memcpy implementation does open one, so the current code handles this only for that export. This matters beyond Windows write permissions: GuestArenaBeginHostWrite also notifies the guest write-watch/shared-backing machinery, and the repository consistently scopes direct writes to guest buffers for that reason. For example, fread in core/libs/prx/libc/src/FileAndHeap.cpp validates and guards its output range before writing. Please add appropriately sized HostWrite guards around the string destinations (including the terminator for concatenation) and handle a failed Open() consistently with the surrounding guest-memory APIs. The existing canary tests use ordinary host arrays and will not detect a missing guest-memory write notification; a focused GuestArena/write-watch test would cover this path.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5642972410 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10964#pullrequestreview-5642972410). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T11:33:58Z. **Review:** CHANGES_REQUESTED --- The four string-writing functions (`u_strcpy`, `u_strncpy`, `u_strcat`, and `u_strncat`) write directly through guest pointers without opening a `GuestArena::HostWrite` scope. The `u_memcpy` implementation does open one, so the current code handles this only for that export. This matters beyond Windows write permissions: `GuestArenaBeginHostWrite` also notifies the guest write-watch/shared-backing machinery, and the repository consistently scopes direct writes to guest buffers for that reason. For example, `fread` in `core/libs/prx/libc/src/FileAndHeap.cpp` validates and guards its output range before writing. Please add appropriately sized `HostWrite` guards around the string destinations (including the terminator for concatenation) and handle a failed `Open()` consistently with the surrounding guest-memory APIs. The existing canary tests use ordinary host arrays and will not detect a missing guest-memory write notification; a focused GuestArena/write-watch test would cover this path.
MarcZX10 commented 2026-10-25 13:30:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T13:30:50Z.

Review: APPROVED


Reviewed updated head 0b58809a25dcb5c0c2d439f3156fa6133a71f2cc. The string writers now guard the exact destination range before mutation: strncpy covers only copied units, strcat includes the replaced terminator, and strncat includes its appended terminator. The five copy exports reject a failed guard; nonpositive count paths still return without touching either pointer. The new direct guest mapping tests exercise shared backing/write-watch, precise page-boundary ranges, read-only unused capacity, canaries, and Windows refusal without partial writes.

I ran python3 tools/check_conventions.py --base upstream/main --head HEAD and git diff --check upstream/main...HEAD; both pass. The author reports the ICU build and 2/2 focused Linux tests plus pinned-source comparison. Windows-only rejected-write cases are present but unrun; hosted product jobs are skipped. The previously requested guest-write guards are in place. #10963 remains the declared integration predecessor.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5643395380 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10964#pullrequestreview-5643395380). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T13:30:50Z. **Review:** APPROVED --- Reviewed updated head `0b58809a25dcb5c0c2d439f3156fa6133a71f2cc`. The string writers now guard the exact destination range before mutation: `strncpy` covers only copied units, `strcat` includes the replaced terminator, and `strncat` includes its appended terminator. The five copy exports reject a failed guard; nonpositive count paths still return without touching either pointer. The new direct guest mapping tests exercise shared backing/write-watch, precise page-boundary ranges, read-only unused capacity, canaries, and Windows refusal without partial writes. I ran `python3 tools/check_conventions.py --base upstream/main --head HEAD` and `git diff --check upstream/main...HEAD`; both pass. The author reports the ICU build and 2/2 focused Linux tests plus pinned-source comparison. Windows-only rejected-write cases are present but unrun; hosted product jobs are skipped. The previously requested guest-write guards are in place. #10963 remains the declared integration predecessor.
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!10964
No description provided.