comparison 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
comparison
equal deleted inserted replaced
3883:cfe850b334e7 3884:dba874934f0c
588 audio->spec.freq) < 0 ) { 588 audio->spec.freq) < 0 ) {
589 SDL_CloseAudio(); 589 SDL_CloseAudio();
590 return(-1); 590 return(-1);
591 } 591 }
592 if ( audio->convert.needed ) { 592 if ( audio->convert.needed ) {
593 audio->convert.len = desired->size; 593 audio->convert.len = (int) ( ((double) desired->size) /
594 audio->convert.len_ratio );
594 audio->convert.buf =(Uint8 *)SDL_AllocAudioMem( 595 audio->convert.buf =(Uint8 *)SDL_AllocAudioMem(
595 audio->convert.len*audio->convert.len_mult); 596 audio->convert.len*audio->convert.len_mult);
596 if ( audio->convert.buf == NULL ) { 597 if ( audio->convert.buf == NULL ) {
597 SDL_CloseAudio(); 598 SDL_CloseAudio();
598 SDL_OutOfMemory(); 599 SDL_OutOfMemory();