fix(libSceAudioOut): refuse a null attribute list in sceAudioOut2ContextSetAttributes with the console code #18401

Merged
xXPBSXx merged 6 commits from upstream-pr/18401 into main 2026-11-26 02:39:12 +00:00
xXPBSXx commented 2026-11-11 13:25:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-11-11T13:25:22Z.


What

sceAudioOut2ContextSetAttributes returned 0 for a null attribute list with count 0 and 0x80260502 for one with a count; a PS5 returns 0x80268001 for both (measured). Three commits, one file each: test (red on main: the first new Require, the null list with count 0, aborts; the null list with count 1 is covered only by the green run), fix (AudioOut2Context.cpp: a null list returns 0x80268001, no id or value check; a context that is not live keeps INVALID_HANDLE first), docs (the sceAudioOut2ContextSetAttributes entry of docs/dev/debt/libSceAudioOut.md, 864 characters; its old half sentence about a null list with a count (INVALID_ARGUMENT) now says 0x80268001, and the entry states that a PS5 answered 0 for context 0, which this library refuses). Not changed on purpose: the console refused ids 0, 3, 4, 0x100 and 0xffffffff, a null value and size 0 for id 2, and answered 0 for context 0; the library still accepts every id and value because the set of valid ids is not measured (only 0 to 4, 0x100 and 0xffffffff), and a title may set an id above 4. The function is imported by PPSA02225, PPSA02530, PPSA07411, PPSA23126 and PPSA30601 among the titles I ran (relinker registries, NID 4dq2rblWlg0); this is an import, not a call count, and the change unblocks no title by itself. The 0x8026800x codes against the 0x8026050x family are not touched here. The entry:

  • sceAudioOut2ContextSetAttributes (libSceAudioOut) - for a valid context and a non-null attribute list, returns 0 and ignores every attribute (an invalid context gives INVALID_HANDLE, a null list 0x80268001); what a context attribute changes on a console is unknown. A PS5 (firmware 11.60, payload process; a title process may differ) accepted ids 1 and 2 with a 4-byte value 1 and refused with 0x80268001 a null list with count 0 or 1, as this library does, and ids 0, 3, 4, 0x100 and 0xffffffff, a null value and size 0 for id 2, which it still accepts; it answered 0 for context 0, which this library refuses; ids above 4 other than 0x100 are not measured. PPSA25286 01.000.568 sets attribute 2 to a 4-byte 1 at start-up, and PPSA02225 passes two attributes from an object at its single call.

Tested

ctest audio_out2_context_handles, ASan + UBSan, WSL, same base for both runs: the test commit alone Subprocess aborted at the first new Require ('an empty null attribute list was not refused with the console code'; the count-1 answer is shown only by the green run), with the fix Passed. Console measurement (payload process, firmware 11.60; a title process may differ), 13 SetAttributes cases (19 cases in all) on a context made by the second sceAudioOut2ContextCreate of the process (the first returned handle 0): ids 1 and 2 with a 4-byte value 1 return 0; ids 0, 3, 4, 0x100, 0xffffffff, a null value, size 0, and a null list with count 0 or 1 return 0x80268001; size 8 returns 0; context 0 returns 0. The probe source and raw log go in the first comment. check_conventions passes.

Overlap: the 21 other open pull requests that change AudioOut2Context.cpp, AudioOut2ContextHandles.cpp or docs/dev/debt/libSceAudioOut.md (found by reading the changed files of all 1986 open pull requests) were checked on 2026-11-11 at about 13:10 UTC against main ed4b2e4cd8; the branch merges into it without a conflict (it is based on the older aece3f1a22). #5021, #14212 and #18044 already conflict with main without this change; 17 merge cleanly with and without it. #18040 (guard the queue-level outputs) conflicts only with this change, in AudioOut2ContextHandles.cpp, where both add tests in the same place; whichever merges second needs a small rebase.

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
  • 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 (the test builds no Vulkan device)
  • AI-assisted: yes

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5260288852 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18401). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-11-11T13:25:22Z. --- ### What sceAudioOut2ContextSetAttributes returned 0 for a null attribute list with count 0 and 0x80260502 for one with a count; a PS5 returns 0x80268001 for both (measured). Three commits, one file each: test (red on main: the first new Require, the null list with count 0, aborts; the null list with count 1 is covered only by the green run), fix (AudioOut2Context.cpp: a null list returns 0x80268001, no id or value check; a context that is not live keeps INVALID_HANDLE first), docs (the sceAudioOut2ContextSetAttributes entry of docs/dev/debt/libSceAudioOut.md, 864 characters; its old half sentence about a null list with a count (INVALID_ARGUMENT) now says 0x80268001, and the entry states that a PS5 answered 0 for context 0, which this library refuses). Not changed on purpose: the console refused ids 0, 3, 4, 0x100 and 0xffffffff, a null value and size 0 for id 2, and answered 0 for context 0; the library still accepts every id and value because the set of valid ids is not measured (only 0 to 4, 0x100 and 0xffffffff), and a title may set an id above 4. The function is imported by PPSA02225, PPSA02530, PPSA07411, PPSA23126 and PPSA30601 among the titles I ran (relinker registries, NID 4dq2rblWlg0); this is an import, not a call count, and the change unblocks no title by itself. The 0x8026800x codes against the 0x8026050x family are not touched here. The entry: - [sceAudioOut2ContextSetAttributes](../../../core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp) (libSceAudioOut) - for a valid context and a non-null attribute list, returns 0 and ignores every attribute (an invalid context gives `INVALID_HANDLE`, a null list 0x80268001); what a context attribute changes on a console is unknown. A PS5 (firmware 11.60, payload process; a title process may differ) accepted ids 1 and 2 with a 4-byte value 1 and refused with 0x80268001 a null list with count 0 or 1, as this library does, and ids 0, 3, 4, 0x100 and 0xffffffff, a null value and size 0 for id 2, which it still accepts; it answered 0 for context 0, which this library refuses; ids above 4 other than 0x100 are not measured. PPSA25286 01.000.568 sets attribute 2 to a 4-byte 1 at start-up, and PPSA02225 passes two attributes from an object at its single call. ### Tested ctest audio_out2_context_handles, ASan + UBSan, WSL, same base for both runs: the test commit alone Subprocess aborted at the first new Require ('an empty null attribute list was not refused with the console code'; the count-1 answer is shown only by the green run), with the fix Passed. Console measurement (payload process, firmware 11.60; a title process may differ), 13 SetAttributes cases (19 cases in all) on a context made by the second sceAudioOut2ContextCreate of the process (the first returned handle 0): ids 1 and 2 with a 4-byte value 1 return 0; ids 0, 3, 4, 0x100, 0xffffffff, a null value, size 0, and a null list with count 0 or 1 return 0x80268001; size 8 returns 0; context 0 returns 0. The probe source and raw log go in the first comment. check_conventions passes. Overlap: the 21 other open pull requests that change `AudioOut2Context.cpp`, `AudioOut2ContextHandles.cpp` or `docs/dev/debt/libSceAudioOut.md` (found by reading the changed files of all 1986 open pull requests) were checked on 2026-11-11 at about 13:10 UTC against `main` `ed4b2e4cd8`; the branch merges into it without a conflict (it is based on the older `aece3f1a22`). #5021, #14212 and #18044 already conflict with `main` without this change; 17 merge cleanly with and without it. #18040 (guard the queue-level outputs) conflicts only with this change, in `AudioOut2ContextHandles.cpp`, where both add tests in the same place; whichever merges second needs a small rebase. ### 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) - [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 <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a (the test builds no Vulkan device) <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no --> AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
PrivacyOnion commented 2026-11-11 15:35:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-11T15:35:15Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 9f80273ba3:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: audio_out2_context_handles_tests built cleanly.
  • CTest (audio_out2_context_handles):
    1/1 Test #2914: audio_out2_context_handles .......   Passed    0.25 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp reverted to main and the new tests kept, the suite fails:
    1/1 Test #2914: audio_out2_context_handles .......Subprocess aborted***Exception:   0.53 sec
    0% tests passed, 1 tests failed out of 1
    
    Restoring the change makes it pass again.
  • Code reading:
    • core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp: Verified sceAudioOut2ContextSetAttributes preserves handle validation precedence, returning SCE_AUDIO_OUT2_ERROR_INVALID_HANDLE (0x80260503) for non-existent contexts before inspecting attributes.
    • core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp: Verified null attributes return static_cast(0x80268001) for both num == 0 and num > 0, replacing the prior incorrect 0 and SCE_AUDIO_OUT2_ERROR_INVALID_ARGUMENT (0x80260502) returns.
    • core/libs/prx/libSceAudioOut/tests/AudioOut2ContextHandles.cpp: Verified ContextAttributesNullList tests both nullptr with num == 0 and nullptr with num == 1 against 0x80268001 and destroys the context cleanly.
    • core/libs/prx/libSceAudioOut/tests/AudioOut2ContextHandles.cpp: Verified test execution order in main() and confirmed negative gate aborts on unpatched main while passing cleanly with the patch.
    • docs/dev/debt/libSceAudioOut.md: Verified technical debt documentation accurately describes the updated error code (0x80268001) and records console probe observations without code special-casing.
    • AGENTS.md compliance: Verified no comments were added to source or test files, no temporary or investigation files were introduced, and conventional conventions passed cleanly.
  • Minor: please drop the Generated with footer from the description; the AI-assisted checkbox can stay.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5861258425 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18401#pullrequestreview-5861258425). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-11T15:35:15Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `9f80273ba3`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `audio_out2_context_handles_tests` built cleanly. - **CTest** (`audio_out2_context_handles`): ``` 1/1 Test #2914: audio_out2_context_handles ....... Passed 0.25 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/1 Test #2914: audio_out2_context_handles .......Subprocess aborted***Exception: 0.53 sec 0% tests passed, 1 tests failed out of 1 ``` Restoring the change makes it pass again. - **Code reading**: - core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp: Verified sceAudioOut2ContextSetAttributes preserves handle validation precedence, returning SCE_AUDIO_OUT2_ERROR_INVALID_HANDLE (0x80260503) for non-existent contexts before inspecting attributes. - core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp: Verified null attributes return static_cast<int>(0x80268001) for both num == 0 and num > 0, replacing the prior incorrect 0 and SCE_AUDIO_OUT2_ERROR_INVALID_ARGUMENT (0x80260502) returns. - core/libs/prx/libSceAudioOut/tests/AudioOut2ContextHandles.cpp: Verified ContextAttributesNullList tests both nullptr with num == 0 and nullptr with num == 1 against 0x80268001 and destroys the context cleanly. - core/libs/prx/libSceAudioOut/tests/AudioOut2ContextHandles.cpp: Verified test execution order in main() and confirmed negative gate aborts on unpatched main while passing cleanly with the patch. - docs/dev/debt/libSceAudioOut.md: Verified technical debt documentation accurately describes the updated error code (0x80268001) and records console probe observations without code special-casing. - AGENTS.md compliance: Verified no comments were added to source or test files, no temporary or investigation files were introduced, and conventional conventions passed cleanly. - Minor: please drop the `Generated with` footer from the description; the AI-assisted checkbox can stay. Looks Good To Me
MarcZX10 commented 2026-11-12 14:25:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-12T14:25:26Z.

Review: COMMENTED


Reviewed sceAudioOut2ContextSetAttributes null-list fix — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head: 9f80273ba3189720a41d758faeed279b025a8b59, base main.
  • Read the diff of all three changed files, and the head text of core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp lines 505 to 520.
  • No build and no test run. This review used reads only.
python3 repo_read.py cat core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp 505 520

Results

Check Result Note
Changed function at head passed Matches the diff
Unit test audio_out2_context_handles not run No build in this review
Red-then-green test run not run Author-reported only
Console measurements in docs not run Author-reported only

Findings

Blocking

None.

Non-blocking

  • core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp:512: the new line writes the raw code, static_cast<int>(0x80268001). The same file already names that code at head, in sceAudioOut2ContextBedWrite (constexpr int ErrorInvalidParam = static_cast<int>(0x80268001);, line 520). A named constant would read more clearly. The inline form also matches the test, so leaving it is consistent too.

Not verified

  • Build and run of audio_out2_context_handles on this head. The claim in the description that the test is red on main is not checked.
  • Console measurements in the docs entry and the description (firmware 11.60, payload process). They are author-reported, and the repository cannot confirm them.
  • The overlap claims with the 21 open pull requests, and the conflict with #18040. Not checked.
  • Whether SCE_AUDIO_OUT2_ERROR_INVALID_ARGUMENT is still used elsewhere after this change. The reader's search returned no lines for a pattern that the head file contains, so this name check was not done.
  • Files read: AudioOut2Context.cpp (diff, and head lines 505 to 520). AudioOut2ContextHandles.cpp and docs/dev/debt/libSceAudioOut.md were read as diff hunks only, not as full text at head. Excluded by rule: none.

To get this to a good state

Nothing is required. The non-blocking point above is optional.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5876086776 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18401#pullrequestreview-5876086776). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-12T14:25:26Z. **Review:** COMMENTED --- # Reviewed sceAudioOut2ContextSetAttributes null-list fix — no blocking findings Nothing blocks this; the points below are optional. ## What I ran - Head: `9f80273ba3189720a41d758faeed279b025a8b59`, base `main`. - Read the diff of all three changed files, and the head text of `core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp` lines 505 to 520. - No build and no test run. This review used reads only. ``` python3 repo_read.py cat core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp 505 520 ``` ## Results | Check | Result | Note | |---|---|---| | Changed function at head | passed | Matches the diff | | Unit test `audio_out2_context_handles` | not run | No build in this review | | Red-then-green test run | not run | Author-reported only | | Console measurements in docs | not run | Author-reported only | ## Findings ### Blocking None. ### Non-blocking - `core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp:512`: the new line writes the raw code, `static_cast<int>(0x80268001)`. The same file already names that code at head, in `sceAudioOut2ContextBedWrite` (`constexpr int ErrorInvalidParam = static_cast<int>(0x80268001);`, line 520). A named constant would read more clearly. The inline form also matches the test, so leaving it is consistent too. ## Not verified - Build and run of `audio_out2_context_handles` on this head. The claim in the description that the test is red on `main` is not checked. - Console measurements in the docs entry and the description (firmware 11.60, payload process). They are author-reported, and the repository cannot confirm them. - The overlap claims with the 21 open pull requests, and the conflict with #18040. Not checked. - Whether `SCE_AUDIO_OUT2_ERROR_INVALID_ARGUMENT` is still used elsewhere after this change. The reader's search returned no lines for a pattern that the head file contains, so this name check was not done. - Files read: `AudioOut2Context.cpp` (diff, and head lines 505 to 520). `AudioOut2ContextHandles.cpp` and `docs/dev/debt/libSceAudioOut.md` were read as diff hunks only, not as full text at head. Excluded by rule: none. ## To get this to a good state Nothing is required. The non-blocking point above is optional.
MarcZX10 commented 2026-11-22 11:40:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T11:40:47Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the updated null-list behavior is consistent with the console result reported in the PR description.

What I ran

Reviewed head 6207e4d567fafdf056cb3a1ac5789d86b31b0524. No commands or tests were run. Read description.md, commits.md, manifest.json, diff.patch, and all five changed files at the pinned head: AudioOut2Context.cpp, AudioOut2ContextHandles.cpp, AudioOut2DeviceState.cpp, AudioOut2Timing.cpp, and libSceAudioOut.md.

Results

Check Result Note
Diff and changed source review passed All five changed files read
Tests not run Test results are author reported
Console measurement not run Measurement is author reported

Findings

Blocking

None.

Non-blocking

None.

Not verified

The reported test runs, console measurement, and check_conventions were not independently verified. No files were excluded from the reviewed change set; files.json was not available as a document, so the changed-file listing in manifest.json and the review directory listing were used to identify files.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6012022980 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18401#pullrequestreview-6012022980). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T11:40:47Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the updated null-list behavior is consistent with the console result reported in the PR description. ## What I ran Reviewed head `6207e4d567fafdf056cb3a1ac5789d86b31b0524`. No commands or tests were run. Read `description.md`, `commits.md`, `manifest.json`, `diff.patch`, and all five changed files at the pinned head: `AudioOut2Context.cpp`, `AudioOut2ContextHandles.cpp`, `AudioOut2DeviceState.cpp`, `AudioOut2Timing.cpp`, and `libSceAudioOut.md`. ## Results | Check | Result | Note | |---|---|---| | Diff and changed source review | passed | All five changed files read | | Tests | not run | Test results are author reported | | Console measurement | not run | Measurement is author reported | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The reported test runs, console measurement, and check_conventions were not independently verified. No files were excluded from the reviewed change set; `files.json` was not available as a document, so the changed-file listing in `manifest.json` and the review directory listing were used to identify files. ## To get this to a good state Nothing is required.
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!18401
No description provided.