Commit fce92444 authored by Ryan C. Gordon's avatar Ryan C. Gordon

Fix for buffer overflow in audio code, when feeding a device that needs

 resampling.

Fixes Bugzilla #298.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402200
parent 0a1cd99d
...@@ -590,7 +590,8 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained) ...@@ -590,7 +590,8 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
return(-1); return(-1);
} }
if ( audio->convert.needed ) { 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.buf =(Uint8 *)SDL_AllocAudioMem(
audio->convert.len*audio->convert.len_mult); audio->convert.len*audio->convert.len_mult);
if ( audio->convert.buf == NULL ) { if ( audio->convert.buf == NULL ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment