feat(libSceIcu): implement ucal calendar and timezone exports #27653
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27653"
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 Ynryo on 2026-11-26T21:50:10Z.
What
Implement 14
ucal_*exports (ucal_open,ucal_close,ucal_clone,ucal_get,ucal_getAttribute,ucal_getDayOfWeekType,ucal_getDefaultTimeZone,ucal_getCanonicalTimeZoneID,ucal_getTimeZoneDisplayName,ucal_setGregorianChange,ucal_setMillis,ucal_openTimeZones,ucal_openTimeZoneIDEnumeration,ucal_getKeywordValuesForLocale) inlibSceIcuviaCalendarBackendbacked by3rdparty/icu.Tested
Linux (Fedora 44 x86_64):
ctest --test-dir build-full -R guest_icu_recovered_signaturespassed (1/1) andpython3 tools/check_conventions.pypassed.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-26T21:58:53Z.
Review: COMMENTED
Actionable comments posted: 2
31847b36-d49f-48fb-a391-f226508dfe9fReviewing files that changed from the base of the PR and between
00b15fcbb0and35988326ba.cmake/Icu.cmakecore/libs/prx/libSceIcu/CMakeLists.txtcore/libs/prx/libSceIcu/Calendar.cppcore/libs/prx/libSceIcu/CalendarBackend.cppcore/libs/prx/libSceIcu/CalendarBackend.hppcore/libs/prx/libSceIcu/tests/Calendar.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-26T22:14:40Z.
Review: COMMENTED
Actionable comments posted: 1
f9f6c1cb-18f2-41c9-bbc1-0064ee409b54Reviewing files that changed from the base of the PR and between
35988326baanddfdb2c5677.core/libs/prx/libSceIcu/Calendar.cppcore/libs/prx/libSceIcu/tests/Calendar.cppLimit details: You’ve used all 10 included reviews currently available.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T22:15:08Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: fix the calendar output handling and status propagation described below.
What I ran
Reviewed head
dfdb2c567736f8e94564e0813a5b725c3b9759fd. I read the description, commits, manifest, diff, and all changed source and test files. I did not run commands or tests; the Linux test and convention check are author-reported.Results
Findings
Blocking
core/libs/prx/libSceIcu/Calendar.cpp:213:WriteGuestU16Outputcopiessource.data()for the requested count. When ICU returnsU_BUFFER_OVERFLOW_ERROR, the reported required length can exceed the temporary buffer capacity, so the helper limits the copy to guest capacity but still copies that many elements from a buffer sized to capacity. The helper’s count expression can also exceed that buffer whenlength < capacitydue to the terminator slot. This can read past the temporary buffer and produce undefined behavior. Bound the copy by the actual source size, and ensure the ICU call’s buffer and terminator handling agree with that size.core/libs/prx/libSceIcu/Calendar.cpp:226:ucal_getKeywordValuesForLocalepasses the gueststatuspointer directly to the backend, which writes to it as a host pointer. Other wrappers copy status throughGuestCopyIn/GuestCopyOut, so this path can bypass guest-memory validation and write directly through a guest address. Use the local-status and guest-copy status handling used by the other wrappers.Non-blocking
None.
Not verified
guest_icu_recovered_signaturestest andcheck_conventions.pyresults were not independently confirmed.To get this to a good state
Fix both blocking findings, then rerun the reported test and convention check on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-27T08:42:18Z.
Review: COMMENTED
a11944ab-e262-4c1d-a4da-00c979e00421Reviewing files that changed from the base of the PR and between
dfdb2c5677andf5bec1ab0e.core/libs/prx/libSceIcu/Calendar.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T08:46:42Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: bound the guest string reads and avoid narrowing arbitrarily large lengths before copying.
What I ran
Reviewed head
f5bec1ab0ebcc00adbb89782debd6fe8594fbec1. No commands were run; the description reports Linux Fedora 44ctest --test-dir build-full -R guest_icu_recovered_signaturesandpython3 tools/check_conventions.pypassed, but these were not run during this review.Results
Findings
Blocking
core/libs/prx/libSceIcu/Calendar.cpp:220andcore/libs/prx/libSceIcu/Calendar.cpp:248:ReadGuestCStringand the negative-length path ofReadGuestU16Stringloop until a terminator, with no maximum length. A guest can provide a valid, readable unterminated string and cause unbounded host allocation and copying in locale/key/region inputs or zone IDs. Add a defensible maximum and return an error when no terminator is found within it.core/libs/prx/libSceIcu/Calendar.cpp:78: a nonnegative guest UTF-16 length is used directly for allocation and copy; arbitrarily large values can exhaust host memory. Bound it and check the byte-size calculation before allocating or copying.core/libs/prx/libSceIcu/Calendar.cpp:263:hostId.size()is narrowed toint32_twithout validation. For oversized IDs this conversion is implementation-defined and can pass an invalid or negative length into ICU. Reject lengths aboveINT32_MAXbefore conversion.Non-blocking
None.
Not verified
No tests or builds were run. The test source was read, but its reported test execution was not independently verified. Read:
description.md,commits.md,manifest.json,diff.patch,Calendar.cpp,CalendarBackend.cpp,CalendarBackend.hpp, andtests/Calendar.cpp. All changed files listed in the manifest were included in the prepared review folder;files.jsonwas unavailable.cmake/Icu.cmakeandcore/libs/prx/libSceIcu/CMakeLists.txtwere not read from their full head text.To get this to a good state
Bound guest input lengths, reject oversized strings before allocation/copy and before narrowing to
int32_t, then rerun the reported checks on the updated head.Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T10:12:41Z.
Review: COMMENTED
The rebuilt guest ICU recovered-signatures CTest passed on Linux with the bundled ICU backend. The new cases cover calendars, time-zone enumeration and the canonical UTC identifier.
AI-assisted: yes.
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.