# HG changeset patch # User yaz # Date 1173278994 28800 # Node ID 93dbfe1f0cd0b3160ce6db0426cea1fb205c2705 # Parent 98cdc39031f9e98c9b44134af4f22dd6b29e9031 [svn] - same sanity check on rarely executed part. diff -r 98cdc39031f9 -r 93dbfe1f0cd0 ChangeLog --- a/ChangeLog Wed Mar 07 06:16:04 2007 -0800 +++ b/ChangeLog Wed Mar 07 06:49:54 2007 -0800 @@ -1,3 +1,11 @@ +2007-03-07 14:16:04 +0000 Yoshiki Yazawa + revision [1684] + - add sanity check for open audio parameters. + + trunk/src/madplug/decoder.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + + 2007-03-07 13:36:20 +0000 Yoshiki Yazawa revision [1682] - I was noticed vfs_fread check still causes problem. disable for now. diff -r 98cdc39031f9 -r 93dbfe1f0cd0 src/madplug/decoder.c --- a/src/madplug/decoder.c Wed Mar 07 06:16:04 2007 -0800 +++ b/src/madplug/decoder.c Wed Mar 07 06:49:54 2007 -0800 @@ -597,14 +597,24 @@ info->freq = frame.header.samplerate; info->channels = MAD_NCHANNELS(&frame.header); info->playback->output->close_audio(); + + // sanity check. + if(info->fmt < FMT_U8 || info->fmt > FMT_S16_NE) + return NULL; + if(info->freq < 0) // not sure about maximum frequency. --yaz + return NULL; + if(info->channels < 1 || info->channels > 2) + return NULL; + if (!info->playback->output->open_audio(info->fmt, info->freq, info->channels)) { g_mutex_lock(pb_mutex); info->playback->error = TRUE; info->playback->eof = 1; g_mutex_unlock(pb_mutex); - audmad_error("failed to re-open audio output: %s", + g_message("failed to re-open audio output: %s", info->playback->output->description); + return NULL; } } if (!info->playback->playing)