fix(libSceAppContent): check memory ranges in sceAppContentAppParamGetInt #24634

Closed
Sheikh-Bilal65 wants to merge 1 commit from upstream-pr/24634 into main
Sheikh-Bilal65 commented 2026-11-20 21:44:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Sheikh-Bilal65 on 2026-11-20T21:44:44Z.


What

Ensure guest pointer for integer parameter output is safely validated and checked in sceAppContentAppParamGetInt.

Tested

Convention checks and unit tests verified on Windows 11.

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
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: no
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5420711679 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24634). Originally posted by [Sheikh-Bilal65](https://github.com/Sheikh-Bilal65) on 2026-11-20T21:44:44Z. --- ### What Ensure guest pointer for integer parameter output is safely validated and checked in `sceAppContentAppParamGetInt`. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Convention checks and unit tests verified on Windows 11. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: no
MarcZX10 commented 2026-11-21 01:07:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T01:07:49Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the reviewed guest-pointer checks and output copies are consistent with the existing checked-copy helpers.

What I ran

Reviewed head 8eec9d4bc3ca2f4c4194a99c71cbfb23a686465f using the prepared diff and repo_read.py. No commands or tests were run; the Windows 11 test claim is author-reported.

Results

Check Result Note
Diff and targeted source review passed Changed code and callers inspected
Tests not run Author reports Windows 11 tests

Findings

Blocking

None.

Non-blocking

  • The PR title names sceAppContentAppParamGetInt, but that function is unchanged in this diff. Consider updating the title/body to describe the initialization, temporary-space, and PFT pointer checks actually included.

Not verified

The repository files read were core/libs/prx/libSceAppContent/Export.cpp, core/libs/tests/GuestAppContent.cpp, core/libs/prx/libc/src/General.cpp, and docs/dev/debt/changes/appcontent-guest-copy.md; review metadata read was description.md, commits.md, manifest.json, and diff.patch. No changed file was excluded from the prepared bundle. Tests, physical-console behavior, and console behavior with unmapped guest pointers were not verified. The report says convention checks and unit tests passed on Windows 11; I did not run them.

To get this to a good state

Nothing is required. Optional: align the PR title/body with the exports changed in the patch.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6001623734 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24634#pullrequestreview-6001623734). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T01:07:49Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the reviewed guest-pointer checks and output copies are consistent with the existing checked-copy helpers. ## What I ran Reviewed head `8eec9d4bc3ca2f4c4194a99c71cbfb23a686465f` using the prepared diff and `repo_read.py`. No commands or tests were run; the Windows 11 test claim is author-reported. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | Changed code and callers inspected | | Tests | not run | Author reports Windows 11 tests | ## Findings ### Blocking None. ### Non-blocking - The PR title names `sceAppContentAppParamGetInt`, but that function is unchanged in this diff. Consider updating the title/body to describe the initialization, temporary-space, and PFT pointer checks actually included. ## Not verified The repository files read were `core/libs/prx/libSceAppContent/Export.cpp`, `core/libs/tests/GuestAppContent.cpp`, `core/libs/prx/libc/src/General.cpp`, and `docs/dev/debt/changes/appcontent-guest-copy.md`; review metadata read was `description.md`, `commits.md`, `manifest.json`, and `diff.patch`. No changed file was excluded from the prepared bundle. Tests, physical-console behavior, and console behavior with unmapped guest pointers were not verified. The report says convention checks and unit tests passed on Windows 11; I did not run them. ## To get this to a good state Nothing is required. Optional: align the PR title/body with the exports changed in the patch.
PrivacyOnion commented 2026-11-21 01:24:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T01:24:26Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 8eec9d4bc3:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_appcontent_tests built cleanly.
  • CTest (guest_appcontent):
    1/1 Test #3569: guest_appcontent .................   Passed    0.02 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceAppContent/Export.cpp reverted to main and the new tests kept, the suite fails:
    1/1 Test #3569: guest_appcontent .................***Exception: SegFault  1.67 sec
    0% tests passed, 1 tests failed out of 1
    
    Restoring the change makes it pass again.
  • Code reading:
    • Verified GuestCopyIn_nid_no_patch and GuestCopyOut_nid_no_patch error handling and errno restoration across sceAppContentInitialize, sceAppContentTemporaryDataGetAvailableSpaceKb, and sceAppContentGetPftFlag
    • Verified mutex locking discipline and TOCTOU safety in sceAppContentInitialize and sceAppContentTemporaryDataGetAvailableSpaceKb
    • Verified LP64 vs LLP64 portability for sizeof, size_t, and fixed-width integer copies
    • Verified technical debt documentation fragment docs/dev/debt/changes/appcontent-guest-copy.md format and rule compliance
    • Verified guest pointer validation test coverage in GuestAppContent.cpp exercising invalid guest pointer fallbacks with errno preservation

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6001766550 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24634#pullrequestreview-6001766550). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-21T01:24:26Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `8eec9d4bc3`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_appcontent_tests` built cleanly. - **CTest** (`guest_appcontent`): ``` 1/1 Test #3569: guest_appcontent ................. Passed 0.02 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceAppContent/Export.cpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/1 Test #3569: guest_appcontent .................***Exception: SegFault 1.67 sec 0% tests passed, 1 tests failed out of 1 ``` Restoring the change makes it pass again. - **Code reading**: - Verified GuestCopyIn_nid_no_patch and GuestCopyOut_nid_no_patch error handling and errno restoration across sceAppContentInitialize, sceAppContentTemporaryDataGetAvailableSpaceKb, and sceAppContentGetPftFlag - Verified mutex locking discipline and TOCTOU safety in sceAppContentInitialize and sceAppContentTemporaryDataGetAvailableSpaceKb - Verified LP64 vs LLP64 portability for sizeof, size_t, and fixed-width integer copies - Verified technical debt documentation fragment docs/dev/debt/changes/appcontent-guest-copy.md format and rule compliance - Verified guest pointer validation test coverage in GuestAppContent.cpp exercising invalid guest pointer fallbacks with errno preservation Looks Good To Me
MarcZX10 commented 2026-11-25 04:27:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T04:27:22Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the remaining limitations are noted below.

What I ran

Reviewed head 4669e52828efb00aa7f3830b739a87e13e143f38. No commands or tests were run. I read core/libs/prx/libSceAppContent/Export.cpp, core/libs/tests/GuestAppContent.cpp, and docs/dev/debt/changes/appcontent-guest-copy.md; no changed files were excluded.

Results

Check Result Note
Source review passed Changed code and tests read
Tests not run No test execution

Findings

Blocking

None.

Non-blocking

None.

Not verified

No tests or builds were run, so the author-reported Windows 11 checks were not confirmed. Console behavior on unmapped guest memory is also unmeasured, as recorded in the new debt note.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6051856869 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24634#pullrequestreview-6051856869). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-25T04:27:22Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the remaining limitations are noted below. ## What I ran Reviewed head `4669e52828efb00aa7f3830b739a87e13e143f38`. No commands or tests were run. I read `core/libs/prx/libSceAppContent/Export.cpp`, `core/libs/tests/GuestAppContent.cpp`, and `docs/dev/debt/changes/appcontent-guest-copy.md`; no changed files were excluded. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Changed code and tests read | | Tests | not run | No test execution | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified No tests or builds were run, so the author-reported Windows 11 checks were not confirmed. Console behavior on unmapped guest memory is also unmeasured, as recorded in the new debt note. ## To get this to a good state Nothing is required.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!24634
No description provided.