From 80a869109857968c695f321d9a66ee48d9e15298 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 11 May 2023 16:25:20 -0400 Subject: [PATCH] audio: Fixed buffer overflow in SDL_AudioStream resampling. --- src/audio/SDL_audiocvt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index cdabc27e6e..f566f16f6b 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -978,8 +978,8 @@ static int GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int le if ((dst_format == SDL_AUDIO_F32) && (dst_channels == pre_resample_channels)) { resample_outbuf = (float *) buf; } else { - const int input_bytes = input_frames * pre_resample_channels * sizeof (float); - resample_outbuf = (float *) ((workbuf + stream->work_buffer_allocation) - input_bytes); /* do at the end of the buffer so we have room for final convert at front. */ + const int output_bytes = output_frames * pre_resample_channels * sizeof (float); + resample_outbuf = (float *) ((workbuf + stream->work_buffer_allocation) - output_bytes); /* do at the end of the buffer so we have room for final convert at front. */ } ResampleAudio(pre_resample_channels, src_rate, dst_rate,