fix(libSceAudioOut): refuse system debug state and chat calls before sceAudioOut2Initialize #12425
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12425"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by SeaSunPT on 2026-10-28T13:11:17Z.
What
Before
sceAudioOut2Initialize,sceAudioOut2SetSystemDebugState,sceAudioOut2EnableChatandsceAudioOut2DisableChatwent straight to their own work:sceAudioOut2EnableChat()set the chat flag and returned 0, andsceAudioOut2SetSystemDebugStatechecked its pointer, id and size. The console returns0x80268006(not initialized) from all three. Each now returns0x80268006first whenAudioOut2IsInitialized_nid_no_patch()is false, as the mastering calls do since #11244, and changes no state.Source:
sceAudioOut2SetSystemDebugState: #9838 (https://github.com/boykopovar/AnyPS5/pull/9838) read the export in PS5 firmware 3.20 and 4.03 and states that the console checks0x80268006first, before the null pointer, id and size checks. It left the check out only becausesceAudioOut2Initializekept no state onmainthen.sceAudioOut2EnableChatandsceAudioOut2DisableChat: the debt entry (f7a7be1a2) records that both PS5 exports take no arguments and return0x80268006before AudioOut2 initialization, then call the system chat service with selector 3. Neither has another check before the service call, so the order question does not arise.The two debt entries lose the closed clause; the rest stays open: the debug state is still only traced, id
0x20with a 4-byte param still throws, and the chat calls still have no chat service behind them.Tested
Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Ninja, Release,
-DBUILD_TESTING=ON, onmain750cf6cf48.audio_out2_latency(existing test, newTestSystemBeforeInitializerun inmainbeforesceAudioOut2Initialize):sceAudioOut2SetSystemDebugStatewith the loudness state, a null pointer, id 2, id 1 with size 4, id0x20with size 4 and id 1 with a null param all return0x80268006(the last two throw after initialization, so the check comes first), andsceAudioOut2EnableChatandsceAudioOut2DisableChatreturn0x80268006. The existingTestSetSystemDebugStateandTestEnableChatthat run after initialization pass unchanged.AudioOut2System.cppfrommainand the new test kept,audio_out2_latencyfails on its first new check (a debug state before AudioOut2 initialization is refused). With only thesceAudioOut2EnableChatguard removed it fails onenabling chat before AudioOut2 initialization is refused, and with only thesceAudioOut2DisableChatguard removed ondisabling chat before AudioOut2 initialization is refused. With the change it passes.ctest --test-dir build -R "audio" --output-on-failure, three runs: 56/56 passed each time.ctest --test-dir build -R "public_headers" --output-on-failure: 65/65 passed.ctest --test-dir build -j 8 --output-on-failure: 2811/2811 passed, 11 of them skipped (Vulkan feature, SDL pad and fopen tests that skip on this machine, none in libSceAudioOut).python tools/check_conventions.py --base origin/mainpasses;git diff --checkis clean.python tools/pr_overlap.py --branch fix/audioout2-chat-debug-state-not-initialized: no overlap; #5021 conflicts withmainand only sharesdocs/dev/debt/libSceAudioOut.md, so it could not be compared.Linux not tested.
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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T13:53:09Z.
Review: COMMENTED
I reviewed the exact head
9f6c3527ed. The initialization check is placed before pointer/id/size validation and before changing either chat flag, matching the cited console check order and preserving post-initialization behavior. The regression exercises the pointer/id/size precedence cases and both chat calls before initialization, while existing initialized-path tests remain in place. The hosted Windows job and repository checks pass. I could not independently rerun the Windows-only audio suite from this Linux environment; the detailed red-green and full-suite results in the PR description are author-reported. I found no concrete defect in the diff.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T15:53:53Z.
Review: APPROVED
Reviewed exact head
9f6c3527ed5f528f77d3f7061e0fd505e9f19193. The three exports now gate on the tracked AudioOut2 initialization state before argument validation or mutating chat state, matching the console check order recorded from firmware 3.20/4.03 and the existing debt evidence. The focused regression covers null/invalid debug-state inputs and both chat calls before initialization; initialized behavior remains covered by the existing suite. My earlier QEMU run ofaudio_out2_latency_testsexited successfully; hosted Windows and policy checks now pass. I did not run the Windows-only audio tests locally and make no hardware claim. I found no blocking issue.