audio: Fixed buffer overflow in SDL_AudioStream resampling.

This commit is contained in:
Ryan C. Gordon 2023-05-11 16:25:20 -04:00
parent 9bf0934877
commit 80a8691098
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
1 changed files with 2 additions and 2 deletions

View File

@ -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,