test(libSceIcu): keep the string behind a heap UnicodeString alive #27828
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27828"
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 magnub on 2026-11-27T14:30:04Z.
What
In
TestHashAndCompare(from #24291),Heap(u"HELLO", false)builds the guestUnicodeStringfrom a temporarystd::u16string, andHeapstorestext.data()as the array pointer. The temporary is destroyed at the end of that statement, soupperpoints into dead stack memory when the following checks read it. With libstdc++ the characters usually survive there, so the test passes on Linux. With libc++ they do not, anduhash_compareCaselessUnicodeString(Key(&hello), Key(&upper)) == 1fails on macOS ("ICU UnicodeString hash check failed at line 139").The string now lives in
upperTextfor the rest of the function. The other temporaryHeapcalls overwrite the array pointer or fail on the length before the array is read, so they are unchanged. Test-only change.Tested
macOS 27.0.1 (26A434) on an Apple M1 Pro, Apple clang 21.0.0, x86_64 Release build under Rosetta 2. Build:
main2b6c1b0445plus #17425, #11049, #26739 and #25331, which the macOS build needs:guest_icu_unicode_string_hashfails 0/3 at line 139.The same pattern (a
const std::u16string¶meter bound to a literal, itsdata()kept past the statement) reportsstack-use-after-scopeunder AddressSanitizer with GCC 13 on Ubuntu 24.04.tools/check_conventions.py --base origin/mainpasses. Log attached.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
https://claude.ai/code/session_012LL9hfx4BY6MbUCYMduDAQ
Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T14:40:55Z.
Review: APPROVED
Reviewed — looks good
The fix keeps the UTF-16 backing string alive for the heap guest object used by the comparison checks; no blocking defect was found in the changed code.
What I ran
Reviewed head
8a231ffdc316672f8a0b25deb4e03a4ede756d44. Readreview/description.md,review/commits.md,review/manifest.json,review/diff.patch, and the full changed filecore/libs/prx/libSceIcu/tests/UnicodeStringHash.cppthroughrepo_read.py. No build or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
review/files.jsonwas not available through the reader, so excluded-file metadata was not confirmed. The manifest lists one changed file, and its full text was read. Build and test behavior, including the author-reported platform results, was not independently verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-27T14:48:31Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
8a231ffdc3:tools/check_conventions.pypassed.guest_icu_unicode_string_hash_testsbuilt cleanly.guest_icu_unicode_string_hash):Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-11-28T05:06:18Z.
Review: APPROVED
Checked head
8a231ffdc3. All on Windows 11 with WinLibs GCC 15.2 (Release), applied tomaina163d4b886together with #27930, #27929, #27926, #27925, #27924, #27923, #27922, #27901, #27771, #27755, #27748, #27682, #27765.tools/check_conventions.py --headandtools/debt_fold.py --checkpassed and the full build succeeded.guest_icu_unicode_string_hashpasses. In the full CPU suite (5,120 tests) the only failures are unrelated:windows_read_trap_unknownfails onmaintoo (fixed in #28028).frame_capture_minimize,jpeg_external_toolchainandguest_pthread_mutex_contentionare timeouts under load; they pass when run on their own.guest_audio_in_capturepasses 20/20 onmainand with #27922.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by NobleBrains on 2026-12-01T00:22:06Z.
Review: APPROVED
Confirmed on macOS 15.
Setup: Apple M4, macOS 15.7.9, Apple clang 17.0.0 (clang-1700.6.3.2), x86_64 Release under Rosetta,
BUILD_TESTING=ON. These are the OS and compiler generation of themacos-15runner.Tree:
main93d64f2d1e+ the open macOS build fixes #27201, #27739, #27843, #17425, #27827, #27767 (maindoes not build on macOS without them, see #28168), + #22091, #28369, #28075, #28076, #28284, then #17878, #20161, #25134, #26806, #22932, #28373, #27828, #27950, #27582, #24311 merged one after another. All merged cleanly.guest_icu_unicode_string_hash3c81fcd938Full
ctest -j 6after all of them: 7047/7066 pass. Compared with the run before the second group of merges, no test fails that passed before.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T09:13:12Z.
Review: COMMENTED
The Linux
UnicodeStringHashfixture passed with the pinned ICU runtime. I checked the ownership change in the fixture. The named UTF-16 string now remains alive through the hash and comparison checks that use its backing array.AI-assisted: yes.