Repository navigation
fix(libSceFreeTypeOt): validate and safely copy error codes in ft_mem helpers - #22160
Conversation
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against a8f8d44529:
- Conventions:
tools/check_conventions.pypassed. - Build:
guest_freetype_ot_memory_testsbuilt cleanly. - CTest (
guest_freetype_ot_memory):1/1 Test #3665: guest_freetype_ot_memory ......... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 - Negative control: with
core/libs/prx/libSceFreeTypeOt/src/Memory.cppreverted tomainand the new tests kept, the suite fails:Restoring the change makes it pass again.1/1 Test #3665: guest_freetype_ot_memory .........***Exception: SegFault 0.12 sec 0% tests passed, 1 tests failed out of 1 - Code reading:
- Verified Memory.cpp:24,38,52,71,88 null/writable validation on error pointer via GuestWritable_nid_no_patch and safe copy out via GuestCopyOut_nid_no_patch across ft_mem_qalloc, ft_mem_alloc, ft_mem_qrealloc, ft_mem_realloc, and ft_mem_dup.
- Checked ft_mem_alloc, ft_mem_realloc, and ft_mem_dup nested calls: they delegate with internal error variable (&result) which is a valid stack pointer, ensuring nested GuestWritable checks succeed before outer GuestCopyOut.
- Verified error codes InvalidArgument (0x06), ArrayTooLarge (0x0A), and OutOfMemory (0x40) against FreeType/libSceFreeTypeOt specifications.
- Audited LP64/LLP64 portability and 64-bit integer sizing across size conversions and arithmetic.
- Confirmed docs/dev/debt/changes/ fragment formatting and AGENTS.md compliance (no disallowed comments, valid fragment location).
- Confirmed GuestFreeTypeOtMemory.cpp tests properly exercise nullptr and invalid guest address (0x10) error paths across modified helpers.
Looks Good To Me
4ac5d55 to
6a640e6
Compare
|
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) |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The reviewed change adds null error pointer coverage; code paths validate writable error storage before allocation and copy results out safely.
What I ran
Read the prepared diff at head 6a640e610031717b9be4bbaad3bbf1c78684c278. No commands or tests were run; the test commands in the PR description are author-reported.
Results
| Check | Result | Note |
|---|---|---|
| Changed code review | passed | Both changed files read |
| Tests | not run | Author reports targeted test and conventions check |
| Console behavior | not run | Not measured per change note |
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests were run. Repository files read: core/libs/tests/GuestFreeTypeOtMemory.cpp, docs/dev/debt/changes/fix-libSceFreeTypeOt-memory-error-copyout.md, and core/libs/prx/libSceFreeTypeOt/src/Memory.cpp. All changed files listed in the manifest were read; no files were excluded.
To get this to a good state
Nothing is required.
|
Rebased onto |
6a640e6 to
61472ae
Compare
61472ae to
0fbe03f
Compare
|
Updated and rebased onto |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head 0fbe03fbf14a1f4067b737b2a9859035d5c0b2a8 using the prepared diff and repo_read.py for targeted source context. No build or tests were run.
Results
| Check | Result | Note |
|---|---|---|
| Diff and changed files | passed | All four changed files were read. |
| Build and tests | not run | Only the author-reported Linux run is described. |
Findings
Blocking
None.
Non-blocking
None.
Not verified
The reported CTest, debt-fold, and convention checks were not independently run. Windows and console behavior were not verified. The review folder’s files.json was unavailable; the manifest lists four changed files and all four were included and read. No excluded changed files were listed in the manifest.
To get this to a good state
Nothing is required.
|
Tested
AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports. |
What
GuestWritable_nid_no_patchinsideRequireWritable(core/libs/prx/libSceFreeTypeOt/src/Memory.cpp) withGuestArena::HostWriteand preserve callererrnobefore callingNotImplementedAt_nid_no_patchso write-watched error outputs succeed cleanly.guest_freetype_ot_memory_testswithlibcacross all platforms and upgradeGuestPointers()incore/libs/tests/GuestFreeTypeOtMemory.cppwith null-error refusal assertions, armedGuestArenawrite-watchederrorpointer tests (PAGE_READONLYassertion on Windows,GuestArenaCollectWrites/GuestWriteWatchCollectdirty-page verification) acrossft_mem_qalloc,ft_mem_alloc,ft_mem_qrealloc,ft_mem_realloc,ft_mem_dup, andft_mem_strdup, plus0x02read-only arena error refusal checks.docs/dev/debt/changes/fix-libSceFreeTypeOt-memory-error-copyout.md.Tested
/tmp/anyps5_verify_build, rebased ontoorigin/main(5f04682cef, PR head0fbe03fbf1):ctest --test-dir /tmp/anyps5_verify_build --output-on-failure -R "^guest_freetype_ot_memory$": 1/1 Passed.python3 tools/debt_fold.py --checkandpython3 tools/check_conventions.py --base origin/main: Passed cleanly.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)