diff src/audio/SDL_audio.c @ 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 c1b6bb5205f1
children 6d2e1961661a
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 ) {