feat(libSceIcu): implement data-free ucnv converter exports over ICU #18400
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18400"
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 SHOnnay on 2026-11-11T13:24:44Z.
What
Implements 33 throwing
ucnv_*converter exports in libSceIcu.How. They are thin wrappers over the ICU 78.1 submodule the library already builds (
3rdparty/icuat049e0d6a420629ac7db77256987d083a563287b5), following the pattern ofBidi.cppandNormalization.cpp. The code is in the newConverter.cpp/.hpp.Signatures. The 3.20 export names are ICU 68.2 names. Every
U_CAPIprototype inucnv.hmatches betweenrelease-68-2and the pinned 78.1 commit, except thesafeClone→clonerename, which is not among these exports.Exports:
open,openU,closegetName,getMaxCharSize,getMinCharSize,getType,isFixedWidth,isAmbiguous,getCCSID,getPlatform,getStartersgetSubstChars,setSubstChars,setSubstString,getInvalidChars,getInvalidUCharssetFallback,usesFallback,fromUCountPending,toUCountPending,reset,resetToUnicode,resetFromUnicodefromUnicode,toUnicode,fromUChars,toUChars,getNextUChar,convertEx,convert,toAlgorithmic,fromAlgorithmicStill throws. This build has no ICU data files. Wherever ICU would return
U_FILE_ACCESS_ERROR/U_MISSING_RESOURCE_ERROR, the export throws:latin1getCCSIDfor UTF-7, IMAP and ISCIIIt also throws for a null name (ICU would open the host's default converter) and for a non-ASCII
openUname. Every name ICU accepts without data maps to the same converter inconvrtrs.txt, and none is ambiguous.Left throwing:
ucnv_cb*writers and the ESCAPE/SUBSTITUTE callbacks: these need the guest callback ABIgetCanonicalName,openCCSID,openPackageand the available-name lists: these need alias datau_get/release/flushDefaultConverter: the console's default converter is unknownRemoved. The 10 stubs in
Export.cpp/InventoryExports.hppand the 23 inLegacyExports.cpp/.hpp. The debt file is updated: counts, table rows, a Converters entry and the Legacy entry.Tested
macOS 27 on Apple M1. The new registered test
guest_icu_converter(tests/Converter.cpp, 151 checks) is a full-build test and was not run: the full build does not run on macOS. A Linux or Windows run is needed.Expected values come from ICU source and documentation. One example: a UTF-16 BOM is written in platform byte order, so FF FE on the PS5.
Harness. A temporary host harness, not committed, compiled the unchanged
Converter.cpp, the test, and ICU common sources fromIcu.cmake's file list. It passed on x86-64 under Rosetta and on arm64.Mutation check. 6 of 8 hand mutations failed the harness:
The other 2 give the same visible result:
>=→>in openU, and the ASCII limit 0x7f→0xff.Syntax.
-fsyntax-onlypasses on every changed .cpp, with the include paths and defines the CMake target supplies.Overlap. No open PR implements these exports.
gh pr listsearches found nothing.pr_overlap.pyflags #14443 forgetCCSID,openUandtoAlgorithmic. Its diff only moves those stubs, which still throw.LegacyExportsand the debt file.Risks. Behaviour is ICU 78.1's, while the 3.20 console has 68.2.
UBoolresults are normalised to 0/1, and guests are assumed to treatUConverter*as opaque. Null pointers that ICU would dereference throwstd::invalid_argument, as inNormalization.cpp.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
Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T02:50:59Z.
Review: COMMENTED
Reviewed — comments
The converter exports and their tests were read at head
29ac4ea4f431a45a88f442cf7a2020a7b0b8e824; the registered test was not run here, so approval is not justified.What I ran
Results
Findings
Blocking
None.
Non-blocking
ucnv_close_nid_postfixand the reset wrappers pass null converter pointers directly to ICU (Converter.cpp:94-113). ICU APIs expect a converter object, and the other wrappers reject null converters; either guard these wrappers consistently or add evidence that null is a supported no-op.Not verified
Converter.cpp,Converter.hpp, the converter test,CMakeLists.txt,Export.cpp,LegacyExports.cpp,InventoryExports.hpp,LegacyExports.hpp,libSceIcu.hpp, and the two debt files. I did not read the full text of every included changed file; excluded files were not listed in the prepared materials shown to this review.To get this to a good state
Nothing is required. Optional: clarify the null-converter behavior of the close and reset wrappers, and run the registered converter test on a supported full-build platform.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T08:30:17Z.
Review: COMMENTED
Reviewed — comments
Changes are required before merge: the wrappers may pass a null ICU error-status pointer where the corresponding API requires a valid status pointer, causing a null dereference instead of the stated invalid-argument exception.
What I ran
b736b22e0203e63f5558ed71bf2e0c47ed81bae9using the prepared diff and the pinned reader.Results
Findings
Blocking
None verified.
Non-blocking
errordirectly viaStatus(error)without checking it, unlike wrappers usingRequired(error). For example,ucnv_fromUCountPendinganducnv_getInvalidCharscan pass null to ICU (core/libs/prx/libSceIcu/Converter.cpp:195,core/libs/prx/libSceIcu/Converter.cpp:178). This conflicts with the description’s claim that null pointers that ICU would dereference throwstd::invalid_argument. Consider validating required status pointers consistently before forwarding them.Not verified
core/libs/prx/libSceIcu/tests/Converter.cppwere not read. No excluded files were identified in the supplied file list.To get this to a good state
Nothing is required. Optional: validate required status pointers consistently in wrappers that pass
Status(error)directly.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T04:38:35Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge:
ucnv_openUcan read beyond the supplied buffer when given an unterminated name.What I ran
Reviewed head
2497bdc0c2a80f9d03fb730976aca9bab3db1a0f. No commands or tests were run; the author reports that the registered test was not run on the full build.Read the prepared description, commits, manifest and diff, plus the complete changed
Converter.cpp,Converter.hpp, andtests/Converter.cppfiles. Other changed files were present in the review materials but their full source was not read.files.jsonwas not available as a review document.Results
Findings
Blocking
core/libs/prx/libSceIcu/Converter.cpp:116scansnameuntil a NUL without a bound on the scan itself. If a guest passes a non-terminatedchar16_tbuffer, the wrapper reads beyond that buffer before it can reject a long name. Bound the scan by the maximum supported name length and return ICU’s illegal-argument status if no terminator is found.Non-blocking
None.
Not verified
The remaining changed files and build integration were not read in full, and the registered test was not run. The prepared
manifest.jsonlists 11 changed files; source review focused on the three files named above. No other review-folder exclusion list was available.To get this to a good state
Bound the
openUscan and add a test using an unterminated name buffer; then run the registered converter test on a supported full-build platform.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T08:42:08Z.
Review: DISMISSED
Reviewed — changes requested
Changes are required before merge: fix the failing null-name behavior in
ucnv_openUand ensure the new test exercises it.What I ran
Reviewed head
b4de92f5c461d20264d798104ad03d697a985bd4using the prepared diff and the pinned reader. No build or test commands were run; the author reports the registered full-build test was not run.Results
Findings
Blocking
core/libs/prx/libSceIcu/Converter.cpp:78: Whenerroris null or already contains a failure,Ready(error)is false anducnv_openUreturnsnullptrbefore checking a null name. With a successful status, the same null name throwsNotImplemented_nid_no_patch. This makes handling of the explicitly unsupported default converter depend on the incoming status and bypasses ICU's normal preexisting-error handling. Check and handle the null name consistently before the early return; add coverage for null name with null and failed status.Non-blocking
None.
Not verified
The author reports syntax-only checks, convention checks, public-header audit, and a temporary host harness; these were not run for this review. The full-build test and physical-console behavior were not verified. Read:
CMakeLists.txt,Converter.cpp,Converter.hpp,Export.cpp,LegacyExports.cpp,InventoryExports.hpp,LegacyExports.hpp,libSceIcu.hpp,tests/Converter.cpp, and both changed debt fragments. The prepared diff, description, commits, manifest, and review folder listing were also read. No changed file was excluded from review.To get this to a good state
Handle the null
openUname consistently for every incoming status and add tests for the null and failed-status cases. Then run the registeredguest_icu_convertertest on a supported full-build platform.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T12:27:59Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the full-build converter test was not run, so formal approval is not justified.
What I ran
Reviewed head
a9f909275fd28c569664fb7fecc8fb90931227fcusing the prepared diff and the pinned repository reader,repo_read.py. No tests or build checks were run by this review.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full-build
guest_icu_convertertest, host harness, syntax checks, conventions check, public-header audit, and console behavior were not independently run. Read:description.md,commits.md,manifest.json,diff.patch,core/libs/prx/libSceIcu/Converter.cpp,core/libs/prx/libSceIcu/Converter.hpp,core/libs/prx/libSceIcu/tests/Converter.cpp,core/libs/prx/libSceIcu/CMakeLists.txt, andcore/libs/prx/libSceIcu/libSceIcu.hpp. All changed paths listed by the review folder were included;files.jsonwas not available as a review document.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T16:37:34Z.
Review: COMMENTED
Reviewed — no blocking findings
The targeted code review found no verified blocking defect; the new converter test and platform build checks were not run in this review.
What I ran
Reviewed head
5688f18360dbea9518ab3ae32e9ddafaadbd98e8from the prepared diff and pinned repository reader. No build or test command was run.Results
Negative control
Not run in this review. The description reports six of eight hand mutations failed a temporary host harness; that harness was not run here.
Findings
Blocking
None.
Non-blocking
Nothing required; running
guest_icu_converteron Linux or Windows would add evidence for the new behavior.Sources
Reviewed the prepared diff and repository files at the pinned head. No external sources used.
Not verified
The new converter test, platform builds, and physical console behavior were not verified here. Read:
Converter.cpp,Converter.hpp,tests/Converter.cpp,CMakeLists.txt,libSceIcu.hpp,Export.cpp,include/InventoryExports.hpp,docs/dev/debt/changes/feat-icu-ucnv.md,docs/dev/debt/changes/feat-icu-ulist.md, plus the relevant changed hunks inLegacyExports.cppandinclude/LegacyExports.hpp. All changed files listed in the manifest were included; the full texts of the latter two legacy export files were not read. Excluded files: none.To get this to a good state
Nothing is required. The optional point above is to run the new test on Linux or Windows.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T16:24:16Z.
Review: COMMENTED
Reviewed — comments
The converter implementation and registered test are reviewed at head
5c528b6580213693db59b13118e9ae5b3ec38f24; the full build test was not run, so a formal approval is not justified.What I ran
Read the prepared diff and changed files at the pinned head. No commands or tests were run.
Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The registered converter test, full build, and console behavior were not run. All files listed as reviewed in the manifest were included; no files were excluded by rule. Read:
CMakeLists.txt,Converter.cpp,Converter.hpp,Export.cpp,LegacyExports.cpp,InventoryExports.hpp,LegacyExports.hpp,libSceIcu.hpp,tests/Converter.cpp, and the two debt change fragments.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T06:26:17Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
080019f2da9450d4c888939b29be4057c639f0eeagainst the prepared diff and the pinned reader. I inspected the changed converter implementation, declarations, tests, export removals, build registration, and debt updates. No executable checks were run.Results
Negative control
Not run. The reported mutation checks used a temporary host harness; I did not independently verify them.
Findings
Blocking
None.
Non-blocking
guest_icu_converterintegration test was not run in the full build. Running it on Linux or Windows would add coverage for the registered target and its project integration. The PR reports a temporary host harness passed, but that result was not independently verified. CMakeLists.txt:786Sources
Not verified
No full build, registered test, or console run was performed. The author-reported syntax checks, conventions audit, temporary host harness, and mutation checks were not independently run. The review folder listed all 12 changed files as reviewed and none as excluded; I read the changed hunks and relevant file text.
To get this to a good state
Nothing is required. Optional: run
guest_icu_converterin a supported Linux or Windows full build.Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T11:54:26Z.
Review: COMMENTED
Compiled the changed converter implementation with the branch’s
Converterfixture against the existing Linux PRXs. It passed converter opening, both UTF-16 conversion directions, substitution, streaming, and unsupported converter cases.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T08:33:46Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The
ucnv_getSubstCharswrapper dereferenceslengthbefore validating it, so a null argument can crash the process.What I ran
Reviewed head
352e440f51c24174ff7bcfb031b21856764bc74e. I inspected the prepared diff and staged file texts; no build or test was run. The pinned reader could not provide repository context because it tried to write its read log in the read-only run folder.Results
Negative control
Not run; no test was run.
Findings
Blocking
core/libs/prx/libSceIcu/Converter.cpp:161:*lengthis evaluated beforeRequired(length)at line 160. Passing a nulllengthpointer therefore dereferences null instead of throwingstd::invalid_argumentas the wrapper's validation intends. Validatelengthbefore this read, and cover the null case.Non-blocking
None.
Sources
Not verified
No tests, build, console behavior, or repository-only callers were verified. The author's reported harness and syntax checks were not run here.
files.jsonlists no excluded changed files.To get this to a good state
Validate
lengthbefore dereferencing it inucnv_getSubstChars, then add or update coverage for a null length pointer.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.