fix(libSceIcu): write utf8_appendCharSafeBody's isError only when the append fails #24088
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24088"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by GiannisG1 on 2026-11-20T05:53:19Z.
What
ICU's
utf8_appendCharSafeBodydereferencespIsErroronly on its error path, when the code point does not fit, is a surrogate or is above U+10FFFF (ICU 68.2utf_impl.cppL215-L217; the same in the 78.1 submodule). Since #22164, the export checksisErrorwithGuestWritable_nid_no_patchbefore every append. This has two effects:isErrorpointer that ICU never touches is refused withstd::invalid_argument.HostMapping::Findon Linux,VirtualQueryon Windows).guest_icu_utf8appends every code point from U+0080 to U+10FFFF with&error. It took 0.09-0.34 s here before #22164 and 1.9-4.7 s after, and it timed out at its 20 s limit inmain's Linux job (run 44639208734, theguest_icu_utf8 (Timeout)entry).This PR drops the up-front check. The error path already writes
isErrorthroughGuestCopyOut_nid_no_patch, which refuses an unmapped or unwritable pointer, so a bad pointer is still refused where ICU would write through it. The debt entry #22164 added (still a pending fragment) now says that.Tested
Linux Mint 22.3, kernel 7.0.0-38, GCC 13.3.0, Release, head on
maind50640e264.guest_icu_utf8: the check that a successful append with an unwritableisError(0x10) throws is replaced by two checks. That append returns the new index, and the same pointer is refused when the append has no room. Onmainthe first check fails (utf8_appendCharSafeBody_nid_postfix: invalid argument), 3 of 3 runs. With this PR the test passes 3 of 3, in 0.30-0.32 s against 1.9-2.5 s onmainon this machine.Utf8.cppchange) merged on top, it merges cleanly and the test passes in 0.17-0.20 s.tools/suite.py: every test once, GPU tests on the GTX 1050 Ti, the HD 630 and llvmpipe) on this PR: GTX 1050 Ti, 6338 run, 0 failed (guest_icu_utf8in 0.31 s). HD 630, 1457 GPU tests: the 9 failures ofmain0626a8334f's own split suite on this machine, andagc_driver_frame_replay_rewind_copy, which is intermittent (#22028). llvmpipe, 1457:agc_driver_image_gather_lod,agc_driver_image_table_packed_guards,agc_driver_scattered_runsandagc_driver_sparse_dma_buf_straddle, the llvmpipe failures of the samemainLinux job (the last from #23272, which this base still has). None is in libSceIcu.check_conventions.py,check_test_registration.py,check_main_sync.py(merges cleanly with currentmain),check_compile.py,debt_fold.py --checkandgit diff --checkare clean.tools/progress.py --module libSceIcu: nothing pending.pr_overlap.py --branch: no overlap with open pull requests.No title speed is claimed.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T05:56:14Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
06a05da18f:tools/check_conventions.pypassed.guest_icu_utf8_testsbuilt cleanly.guest_icu_utf8):core/libs/prx/libSceIcu/Utf8.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T06:03:03Z.
Review: APPROVED
Reviewed — looks good
The append now permits an unused
isErrorpointer on success and validates it through the existing copy-out only when an error must be reported; I found no blocking defect in the changed code.What I ran
Reviewed head
06a05da18f02a6740cb14103f254ff367516f18cusing the prepared diff and readerrepo_read.py. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests or build checks were run. The PR description reports test and suite results, but those were not independently confirmed. All three files listed as reviewed in the manifest were read:
core/libs/prx/libSceIcu/Utf8.cpp,core/libs/tests/GuestIcuUtf8.cpp, anddocs/dev/debt/changes/fix-libSceIcu-utf8-guest-pointers.md. No files were listed as excluded in the manifest; a separatefiles.jsonwas not available through the reader.To get this to a good state
Nothing is required.