Repository navigation
fix(libSceFont): safely copy out scaled kerning in sceFontGetRenderScaledKerning - #22100
Conversation
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 3f921d2038:
- Conventions:
tools/check_conventions.pypassed. - Build:
guest_font_testsbuilt cleanly. - CTest (
guest_font):1/1 Test #3554: guest_font ....................... Passed 0.02 sec 100% tests passed, 0 tests failed out of 1 - Negative control: with
core/libs/prx/libSceFont/src/Render.cppreverted tomainand the new tests kept, the suite fails:Restoring the change makes it pass again.1/1 Test #3554: guest_font .......................***Exception: SegFault 0.13 sec 0% tests passed, 1 tests failed out of 1 - Code reading:
- Verified core/libs/prx/libSceFont/src/Render.cpp: sceFontGetRenderScaledKerning checks kerning for nullptr and safely copies out local zeroed FontKerning via CopyOutGuest, returning SCE_FONT_ERROR_INVALID_PARAMETER on unmapped/unwritable guest pointers.
- Verified lock acquisition and release symmetry for both fontLock and cachedLock across all code paths, ensuring no deadlock or leaked mutexes on early exits or copy failure.
- Verified error return precedence: kerning validation before font handle validation and renderer binding checks, matching sceFontGetKerning and libSceFont conventions.
- Verified docs/dev/debt/changes/fix-libSceFont-getRenderScaledKerning-copyout.md complies strictly with AGENTS.md technical debt fragment requirements and naming conventions.
- Verified core/libs/tests/GuestFont.cpp exercises invalid pointer handling and validates caller errno preservation (EBUSY) across the CopyOutGuest boundary.
Looks Good To Me
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
sceFontGetRenderScaledKerning now checks its guest output pointer with CopyOutGuest and writes a local value, and I found no defect in the changed code. Nothing blocks this; the points below are optional.
What I ran
- Head
3f921d2038db301254e969aec5a1a21d89abb4d7, basemain. Readdescription.md,commits.md,manifest.json,files.jsonanddiff.patchfrom the review folder. - Read the head code with the repository reader (
repo_read.py):
repo_read.py cat core/libs/prx/libSceFont/src/Render.cpp 300 345
repo_read.py search CopyOutGuest
repo_read.py cat core/libs/prx/libSceFont/include/FontInternal.hpp 1 50
repo_read.py cat core/libs/tests/GuestFont.cpp 1 30
repo_read.py search errno core/libs/tests/GuestFont.cpp
repo_read.py cat docs/core/libs/prx/libSceFont/src/Render.cpp 1 1
- No build, unit test or convention script was run.
Results
| Check | Result | Note |
|---|---|---|
| Changed hunks at head | passed | No defect found |
Build and guest_font_tests |
not run | Author-reported only |
check_conventions.py |
not run | Author-reported only |
| Relative link in change note | failed | Target path does not exist at head |
Findings
Blocking
None.
Non-blocking
docs/dev/debt/changes/fix-libSceFont-getRenderScaledKerning-copyout.md:5: the link../../../core/libs/prx/libSceFont/src/Render.cppresolves todocs/core/...from this folder, and that path does not exist at head. The note is four levels below the root, so it needs four../to reachcore/.
Sources
CopyOutGuestsaves and restoreserrno:AnyPS5/core/libs/prx/libSceFont/include/FontInternal.hpp
Lines 24 to 30 in 3f921d2
- Changed function:
AnyPS5/core/libs/prx/libSceFont/src/Render.cpp
Lines 317 to 343 in 3f921d2
Not verified
- The build,
guest_font_testsandcheck_conventions.pywere not run. The description reports them as passing; that is the author's claim. - The new test passes
0x10as the destination and expectsSCE_FONT_ERROR_INVALID_PARAMETERwitherrnokept. This holds only ifGuestCopyOut_nid_no_patchrejects0x10in the test fixture. I did not confirm that. - Console behaviour for an unwritable destination is not measured; the change note says so.
- Only parts of two files were read:
Render.cpplines 300–345 of 641, andGuestFont.cpplines 1–30 plus the changed hunk of 1259. The rest of both files was not read.FontInternal.hppwas read at lines 1–50.
To get this to a good state
Nothing is required.
Optional: in the change note, use four ../ before core/ so the link resolves.
|
Windows result for head Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release,
AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine. |
|
Tested head Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release,
Whole batch: the full This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code) |
3f921d2 to
bce7d3a
Compare
|
@MarcZX10 Rebased onto |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing blocks this change; the review found no verified blocking defects.
What I ran
Reviewed head bce7d3ae957db81434e73bd6e817ee76e01d58f9 using the prepared diff and repo_read.py for targeted source reads. No build or tests were run.
Results
| Check | Result | Note |
|---|---|---|
| Diff and targeted source review | passed | Changed logic and test context inspected |
| Build and tests | not run | Author reports guest_font_tests passed |
| Conventions check | not run | Author reports it passed |
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full test suite, build, conventions check, and physical-console behavior were not verified. All three changed files listed in the manifest were read; none were excluded from the review bundle.
To get this to a good state
Nothing is required.
|
Additional Linux coverage for exact head Test-only follow-up commit, based directly on this PR head, extends On Arch Linux 7.3.5, GCC 16.2.1, Release, the enhanced Build/test logs, JUnit, loader proof, patches and source pins, SHA-256 AI-assisted: yes |
What
This pull request ensures
sceFontGetRenderScaledKerning(core/libs/prx/libSceFont/src/Render.cpp) safely writes tokerningviaCopyOutGuest(GuestCopyOut_nid_no_patchpreservingerrno) instead of dereferencingkerningdirectly:*kerningviaCopyOutGuestupfront before checking the font handle/locks and copies the computedFontKerningviaCopyOutGuest, returningSCE_FONT_ERROR_INVALID_PARAMETERon unwritable output while preserving callererrno.0x10) anderrno == EBUSYpreservation assertion incore/libs/tests/GuestFont.cpp.Closes when:/Labels:metadata indocs/dev/debt/changes/fix-libSceFont-getRenderScaledKerning-copyout.md(retaining../../../perdocs/dev/TechnicalDebt.mdrelative link base rules).Tested
guest_font_tests(ctest --test-dir /tmp/anyps5_build_pad --output-on-failure -R "^guest_font$"):1/1passed.python3 tools/check_conventions.py --base origin/main.Checklist
Fixes: none
Unblocks: none
GPUs tested: none