# HG changeset patch # User yaz # Date 1173276964 28800 # Node ID 98cdc39031f9e98c9b44134af4f22dd6b29e9031 # Parent 2b2313fc1ddcfe84803ced89b26c17d46c4745ab [svn] - add sanity check for open audio parameters. diff -r 2b2313fc1ddc -r 98cdc39031f9 ChangeLog --- a/ChangeLog Wed Mar 07 05:36:20 2007 -0800 +++ b/ChangeLog Wed Mar 07 06:16:04 2007 -0800 @@ -1,3 +1,11 @@ +2007-03-07 13:36:20 +0000 Yoshiki Yazawa + revision [1682] + - I was noticed vfs_fread check still causes problem. disable for now. + + trunk/src/madplug/decoder.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + + 2007-03-07 13:08:55 +0000 William Pitcock revision [1680] - only perform vfs fseek against info::infile if it is available. diff -r 2b2313fc1ddc -r 98cdc39031f9 src/madplug/decoder.c --- a/src/madplug/decoder.c Wed Mar 07 05:36:20 2007 -0800 +++ b/src/madplug/decoder.c Wed Mar 07 06:16:04 2007 -0800 @@ -208,7 +208,9 @@ BUFFER_SIZE - remainder); if (len <= 0) { - g_message("scan_file: len <= 0! len = %d\n", len); +#ifdef DEBUG + g_message("scan_file: len <= 0! len = %d", len); +#endif break; } @@ -411,6 +413,14 @@ #ifdef DEBUG g_message("decode: fmt = %d freq = %d channels = %d", info->fmt, info->freq, info->channels); #endif + // 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;