Fix for buffer overflow in audio code, when feeding a device that needs SDL-1.2
authorRyan C. Gordon <icculus@icculus.org>
Fri, 27 Oct 2006 20:18:24 +0000
branchSDL-1.2
changeset 3884dba874934f0c
parent 3883 cfe850b334e7
child 3885 a10bddfdc40f
Fix for buffer overflow in audio code, when feeding a device that needs
resampling.

Fixes Bugzilla #298.
src/audio/SDL_audio.c
     1.1 --- a/src/audio/SDL_audio.c	Sat Oct 21 18:53:33 2006 +0000
     1.2 +++ b/src/audio/SDL_audio.c	Fri Oct 27 20:18:24 2006 +0000
     1.3 @@ -590,7 +590,8 @@
     1.4  			return(-1);
     1.5  		}
     1.6  		if ( audio->convert.needed ) {
     1.7 -			audio->convert.len = desired->size;
     1.8 +			audio->convert.len = (int) ( ((double) desired->size) /
     1.9 +                                          audio->convert.len_ratio );
    1.10  			audio->convert.buf =(Uint8 *)SDL_AllocAudioMem(
    1.11  			   audio->convert.len*audio->convert.len_mult);
    1.12  			if ( audio->convert.buf == NULL ) {