Skip to content

test(libSceAudioOut): check that an audio port whose buffer size overflows throws - #9351

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
thuanquang:test/audio-out-buffer-size-overflow
Oct 23, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
thuanquang:test/audio-out-buffer-size-overflow

Conversation

@thuanquang

Copy link
Copy Markdown
Contributor

What

#6199 fixed a heap overflow any title can trigger, and came without a test: sceAudioOutOpen accepts any non-zero length, and before the fix prepareBuffer and queueAudio computed frames * channels * bytes in 32 bits, so a huge length wrapped the buffer size and the mixing loop wrote past an empty vector. The fix computes the size in 64 bits and throws past INT32_MAX (checkedBufferSize, AudioOut.cpp:103-109, called at :202 and :296 on main). AudioOut.cpp keeps changing (#6860 rewrote queueAudio after the fix; open #6879, #5965 and #8652 touch it), so this pins the fix with a CPU-only test.

audio_out_buffer_size_tests compiles AudioOut.cpp with stub SDL functions, as audio_out_vibration_device_tests does, so a main port takes the real device path without audio hardware. Four modes, each its own CTest entry:

Tested

Windows 11 26200, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, main 38d3c0858a.

  • Green: the four tests pass 3 of 3.
  • Red: with both checkedBufferSize call sites (:202, :296) back to the 32-bit products, wrap and threshold fail with "an output whose buffer size overflows did not throw", mix crashes (0xc0000005), and pass_through passes. Since :202 runs first with the same arguments, no test can pin :296 on its own.
  • python tools/check_conventions.py --base origin/main with this title and body passes.
  • Not tested: Linux and macOS builds of the test (the code it covers has no platform branches).

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
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

…flows throws

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 core/libs/prx/libSceAudioOut/CMakeLists.txt
PR 6044 core/libs/prx/libSceAudioOut/CMakeLists.txt

@oneandonlydean oneandonlydean self-assigned this Oct 22, 2026
@oneandonlydean
oneandonlydean merged commit 9f64d92 into boykopovar:main Oct 23, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants