changeset 3884:dba874934f0c SDL-1.2

Fix for buffer overflow in audio code, when feeding a device that needs resampling. Fixes Bugzilla #298.
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 27 Oct 2006 20:18:24 +0000
parents cfe850b334e7
children a10bddfdc40f
files src/audio/SDL_audio.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/audio/SDL_audio.c	Sat Oct 21 18:53:33 2006 +0000
+++ b/src/audio/SDL_audio.c	Fri Oct 27 20:18:24 2006 +0000
@@ -590,7 +590,8 @@
 			return(-1);
 		}
 		if ( audio->convert.needed ) {
-			audio->convert.len = desired->size;
+			audio->convert.len = (int) ( ((double) desired->size) /
+                                          audio->convert.len_ratio );
 			audio->convert.buf =(Uint8 *)SDL_AllocAudioMem(
 			   audio->convert.len*audio->convert.len_mult);
 			if ( audio->convert.buf == NULL ) {