fix(libSceFreeTypeOl): validate guest pointers in charmap exports #27969
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27969"
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 JJenkx on 2026-11-27T23:20:16Z.
What
Validate guest memory reads and writes in
libSceFreeTypeOlcharmap exports (sceFreeTypeOlCMapNew_nid_no_patchandsceFreeTypeOlCMapDone_nid_no_patch) so invalid or read-only guest pointers do not fault the host process:GuestArenaPrepareHostRead_nid_no_patchandGuestReadable_nid_no_patchbeforeGuestCopyIn_nid_no_patchinCopyIn(preservingerrno), and computeGuestFaceRec::internalviaoffsetofinOwner.outputwrites insceFreeTypeOlCMapNew_nid_no_patchwith activeGuestArena::HostWrite+GuestWritable_nid_no_patch+GuestCopyOut_nid_no_patch(preservingerrno), cleaning up the newly created charmap viaFT_CMap_DoneandFreeTypeSyncCharmaps_nid_no_patchif writing backoutputfails afterFT_CMap_Newsucceeds.GuestCharMapRecaddress insceFreeTypeOlCMapDone_nid_no_patchwithoffsetof(GuestCMap, charmap)instead of&cmap->charmap.GuestFreeTypeOlCharmap.cppcovering unmappedclazz/charmap/output/cmap, pre-protected read-onlyoutput, andoutputbecoming read-only during theInitcallback on both success and failure paths.docs/dev/debt/changes/fix-libSceFreeTypeOl-charmap-guest-pointers.md.Tested
GuestFreeTypeOlCharmap.cpptests against unmodifiedCharmap.cpp):guest_freetype_ol_charmapfailed with***Exception: SegFault(0/1 passed) on direct*output = init.guestwrite.guest_freetype_ol_charmap_tests;ctest -R '^guest_freetype_ol_charmap$'passed (1/1,0.00 sec).python3 tools/guest_pointer_audit.py libSceFreeTypeOlreports 0 direct guest pointer accesses inCharmap.cpp.python3 tools/check_conventions.py --base origin/mainpassed.python3 tools/pr_overlap.py --branch fix/libSceFreeTypeOl-charmap-guest-pointers:No overlap with open pull requests.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 PrivacyOnion on 2026-11-27T23:24:55Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
bae4cd6ae1:tools/check_conventions.pypassed.guest_freetype_ol_charmap_testsbuilt cleanly.guest_freetype_ol_charmap):core/libs/prx/libSceFreeTypeOl/Charmap.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 coderabbitai[bot] on 2026-11-27T23:28:50Z.
Review: COMMENTED
22b269db-84c3-46a8-a5e1-d43f0253673dReviewing files that changed from the base of the PR and between
a135c75dbdandbae4cd6ae1.core/libs/prx/libSceFreeTypeOl/Charmap.cppcore/libs/tests/GuestFreeTypeOlCharmap.cppdocs/dev/debt/changes/fix-libSceFreeTypeOl-charmap-guest-pointers.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-11-28T05:39:17Z.
Review: APPROVED
Checked head
bae4cd6ae1. All on Windows 11 with WinLibs GCC 15.2 (Release), applied tomain4c7578e0a4together with #27997, #27996, #27978, #27975, #27973, #27971, #27967, #27964, #27958, #27950, #27949, #27946, #27945, #27943, #27938, #27936.tools/check_conventions.py --headandtools/debt_fold.py --checkpassed and the full build succeeded.guest_freetype_ol_charmappasses. In the full CPU suite (5,131 tests) the only failures are unrelated:windows_read_trap_unknownfails onmaintoo (fixed in #28028), andframe_capture_minimizeis a timeout under load that passes on its own.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T08:21:17Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
bae4cd6ae191d8c2effb3db681b1744836cfac8dusing the prepared diff andrepo_read.py. No tests or other commands were run in this review; test results in the description are author-reported.Results
Findings
Blocking
None in the reviewed code.
Non-blocking
None.
Sources
Not verified
No tests were run. I read the changed hunks and targeted context in
core/libs/prx/libSceFreeTypeOl/Charmap.cpp,core/libs/tests/GuestFreeTypeOlCharmap.cpp,core/libs/prx/libc/include/GuestArena.hpp,core/libs/prx/libc/include/General.hpp, andcore/libs/prx/libSceFreeType/include/GuestObjects.hpp. I also readreview/description.md,review/commits.md,review/manifest.json, andreview/diff.patch. The full changed source files and test file were not read beyond those targeted ranges. No files were excluded according toreview/manifest.json;files.jsonwas unavailable through the reader.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T09:41:31Z.
Review: COMMENTED
The Linux
guest_freetype_ol_charmapCTest passed against the patched library. I checked the new guest-read and guest-write handling in the create and destroy paths, including errno preservation around the source reads.AI-assisted: yes.