ref: bd954b9413a16314c24c17dc9a4aacce3fa4c529
parent: 4746d23891ba45977b5f615859455a4ae7ec6f6c
author: Eric Wasylishen <[email protected]>
date: Tue Oct 31 10:30:08 EDT 2017
Allocate large enough buffer for SDL_ConvertAudio. Fixes #945
--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -631,11 +631,15 @@
AUDIO_U8, 1, samplerate,
mixer_format, mixer_channels, mixer_freq))
{
- convertor.buf = chunk->abuf;
convertor.len = length;
+ convertor.buf = malloc(convertor.len * convertor.len_mult);
+ assert(convertor.buf != NULL);
memcpy(convertor.buf, data, length);
SDL_ConvertAudio(&convertor);
+
+ memcpy(chunk->abuf, convertor.buf, chunk->alen);
+ free(convertor.buf);
}
else
{