Skip to content

Commit 72a3eae

Browse files
hspir404icculus
authored andcommitted
Fix buffer overrun in ConvertAudio with different src/dst channel count
- Source or destination format also has to not be F32 to trigger bug
1 parent 983cfe8 commit 72a3eae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/audio/SDL_audiocvt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ void ConvertAudio(int num_frames,
325325

326326
// Gain adjustment
327327
if (gain != 1.0f) {
328-
float *buf = (float *)(dstconvert ? scratch : dst);
328+
float *buf = (float *)((channelconvert || dstconvert) ? scratch : dst);
329329
const int total_samples = num_frames * src_channels;
330330
if (src == buf) {
331331
for (int i = 0; i < total_samples; i++) {

0 commit comments

Comments
 (0)