Repository navigation
test(libSceAudioOut): check that an audio port whose buffer size overflows throws - #9351
Merged
oneandonlydean merged 1 commit intoOct 23, 2026
Conversation
…flows throws Co-Authored-By: Claude <noreply@anthropic.com>
|
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
#6199 fixed a heap overflow any title can trigger, and came without a test:
sceAudioOutOpenaccepts any non-zero length, and before the fixprepareBufferandqueueAudiocomputedframes * channels * bytesin 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 pastINT32_MAX(checkedBufferSize,AudioOut.cpp:103-109, called at:202and:296onmain).AudioOut.cppkeeps changing (#6860 rewrotequeueAudioafter the fix; open #6879, #5965 and #8652 touch it), so this pins the fix with a CPU-only test.audio_out_buffer_size_testscompilesAudioOut.cppwith stub SDL functions, asaudio_out_vibration_device_testsdoes, so a main port takes the real device path without audio hardware. Four modes, each its own CTest entry:pass_through: a 512-frame F32 8-channel port queues 16384 bytes, the caller's samples, and returns 512 (fix(libSceAudioOut): check the audio buffer size for 32-bit overflow #6199: "normallen = 512still yields 16384").wrap: length0x80000000, F32 8-channel: the output throws and queues nothing (fix(libSceAudioOut): check the audio buffer size for 32-bit overflow #6199: "old wraps0x80000000 * 8 * 4to 0; new throws").mix: the same through F32 8-channel Std, which goes throughprepareBuffer's mixing loop, the path that overflowed.threshold: length0x40000000, S16 mono,0x80000000bytes, one pastINT32_MAX(fix(libSceAudioOut): check the audio buffer size for 32-bit overflow #6199: "throws pastINT32_MAX").Each mode then closes the port, which shows the throw released the port's locks. The open succeeding and the 512 return come from
AudioOut.cpp, not from fix(libSceAudioOut): check the audio buffer size for 32-bit overflow #6199's description; an open-time size check would change the three overflow modes.Tested
Windows 11 26200, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON,main38d3c0858a.checkedBufferSizecall sites (:202,:296) back to the 32-bit products,wrapandthresholdfail with "an output whose buffer size overflows did not throw",mixcrashes (0xc0000005), andpass_throughpasses. Since:202runs first with the same arguments, no test can pin:296on its own.python tools/check_conventions.py --base origin/mainwith this title and body passes.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