Skip to content

fix(libSceFont): safely copy out render weight scale in sceFontGetRenderEffectWeight - #574

Open
Thimo188 wants to merge 1 commit into
mainfrom
upstream-pr/20216
Open

Thimo188 wants to merge 1 commit into
mainfrom
upstream-pr/20216

Conversation

@Thimo188

@Thimo188 Thimo188 commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Imported from boykopovar/AnyPS5#20216, originally opened by Kikoarl.

Source commit: 62a68a5f7d7175c41370027aa77978fd2ed6df20. 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

Safely copy out render weight scale and mode in sceFontGetRenderEffectWeight via CopyOutGuest, preserving caller errno and returning SCE_FONT_ERROR_INVALID_PARAMETER if destination pointers are unwritable.

Tested

  • guest_font_tests (passed)
  • tools/check_conventions.py --base origin/main

Checklist

  • Code follows the style guidelines of this project
  • Tests have been added or updated
  • Documentation has been updated
  • Dependencies have been added or updated
  • Fixes: none
  • Unblocks: none
  • Depends on: none
  • GPUs tested: none
  • AI-assisted: yes

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling when retrieving font render effect weights, including invalid or unwritable output parameters. Failed reads now reset requested outputs to defaults.
  • Tests
    • Added checks for invalid font handles, null or invalid output pointers, and preservation of errno.
  • Documentation
    • Recorded the behavior for unwritable outputs and noted that console behavior for unmapped memory remains unverified.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: Font render-effect weight query

Layer / File(s) Summary
Render-effect output handling and validation
core/libs/prx/libSceFont/src/Style.cpp, core/libs/tests/GuestFont.cpp, docs/dev/debt/changes/fix-libSceFont-getRenderEffectWeight-copyout.md
The query stages requested outputs locally and reports invalid parameters when guest copies fail. Tests cover invalid handles, null outputs, invalid output addresses, and preserved errno. The debt note documents copy-out behavior and says console behavior for unmapped memory is unmeasured.

Change: Bug fix

Merge Risk: Minimal · up to 62a68

This change makes the font render-effect weight query handle unwritable output pointers safely by returning an invalid-parameter error and preserving errno. No actionable merge-blocking risk was identified.

Security architecture risk: Minimal · up to 62a68

libSceFont replaces direct writes through guest-supplied pointers with checked copy-out, without changing the export or its font-handle and renderer checks. Copy-out is not all-or-nothing: callers should use the returned values only on success.

Security review details

Security Blast Radius

  • observed — The changed success path is reached through the existing guest query after the existing font-handle and renderer checks. It copies only the requested weight scales and mode to caller-selected destinations. The GuestFont changes exercise that query; they do not add a production entrypoint.

Trust Boundaries and Controls

  • observed — Guest-supplied addresses no longer reach the style getter as write targets. CopyOutGuest preserves errno on normal return and delegates each scalar write to libc's GuestArena and platform write checks. Those checks do not by themselves establish guest-only address ownership.
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

Usage-based review receipt

  • Mode: Continue automatically
  • Reviewed files: 3
  • Waived: $0.75 (charged $0.00)
  • View usage details

Note

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: 5280204a-5f4d-4977-be3b-c86a4f24352a
Commits

Reviewing files that changed from the base of the PR and between 4131f51 and 62a68a5.

Files selected for processing: 3

  • core/libs/prx/libSceFont/src/Style.cpp
  • core/libs/tests/GuestFont.cpp
  • docs/dev/debt/changes/fix-libSceFont-getRenderEffectWeight-copyout.md

Limit details: You’ve used all 10 included reviews currently available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants