You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(libSceFreeTypeOt): release references when result allocation throws - #2111
Source commit: 828f6f5f3643bed03aecbf2670b5c4019cbeb38c. The import branch preserves this fetched upstream PR snapshot. The description and validation below are copied from upstream; no new code changes or test runs were made for this import. Original reviews, discussions, and attachments remain at the linked upstream PR.
What
Release the allocated reference table (OtMemFree(memory, ref)) if OtMemRealloc throws while allocating the result array in FT_Raccess_Get_DataOffsets_nid_postfix, then rethrow the original exception. Distinct from open PR #16367, which moves the null offsets check and catches exceptions in the post-allocation Add() loop but does not free ref if OtMemRealloc itself throws.
Tested
macOS arm64, Apple Clang, production libSceFreeTypeOt raccess component (Raccess.cpp, Memory.cpp, Stream.cpp). The regression test in GuestFreeTypeOtRaccess.cpp fails against unmodified main (FreeType Ot raccess: offset allocation failure frees the reference table) and passes with the fix (Guest FreeType Ot raccess tests passed), verifying both null-returning and throwing result allocation paths leave caller outputs untouched and free the reference array. tools/check_conventions.py, tools/debt_fold.py --check, and git diff --check passed. Full CMake build, runtime, and console testing remain outstanding.
Checklist
Based on current main; no other open PR implements the same functions
One topic per PR; follow-ups go in a new PR
No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
No notes, investigation .md files or images added to the repository (attach them to this PR)
New third-party code is a submodule built from source
Improved reliability when font-related data allocation fails. Resources created earlier in the operation are now released, and allocation errors are handled without publishing incomplete results. This helps prevent resource leaks and keeps failure behavior consistent across allocation failure scenarios.
The allocation path frees the resource-reference array if OtMemRealloc throws. Tests check exception propagation, the 0x40 error for a null return, unchanged caller outputs, and cleanup. The debt entry notes that console behavior is unverified when the guest result allocator or release callback throws.
Suggested reviewers:domx4q, noamroger
Change: Bug fix
Merge Risk: Minimal · up to 828f6
The change fixes a leak of the reference table when the guest allocator throws while FreeType resource offsets are being read. Tests cover both the throwing and null-returning allocator paths. No concrete merge-blocking risk was found. A full build and console testing are still pending.
Security architecture risk: Minimal · up to 828f6
libSceFreeTypeOt now releases its temporary reference table if allocating the result offsets throws. It uses the same allocator record as the existing cleanup paths and leaves successful calls and ordinary allocation-error returns unchanged.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
This review exceeded your plan’s limits and used usage-based reviews—free during trial, billed after paid activation unless disabled. Manage usage-based reviews.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: dda02351-490e-4aad-bdf1-dd8cb37afa5d
Commits
Reviewing files that changed from the base of the PR and between 4131f51 and 828f6f5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Release the allocated reference table (
OtMemFree(memory, ref)) ifOtMemReallocthrows while allocating the result array inFT_Raccess_Get_DataOffsets_nid_postfix, then rethrow the original exception. Distinct from open PR#16367, which moves the nulloffsetscheck and catches exceptions in the post-allocationAdd()loop but does not freerefifOtMemReallocitself throws.Tested
macOS arm64, Apple Clang, production
libSceFreeTypeOtraccess component (Raccess.cpp,Memory.cpp,Stream.cpp). The regression test inGuestFreeTypeOtRaccess.cppfails against unmodifiedmain(FreeType Ot raccess: offset allocation failure frees the reference table) and passes with the fix (Guest FreeType Ot raccess tests passed), verifying both null-returning and throwing result allocation paths leave caller outputs untouched and free the reference array.tools/check_conventions.py,tools/debt_fold.py --check, andgit diff --checkpassed. Full CMake build, runtime, and console testing remain outstanding.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