Mercurial > audlegacy-plugins
changeset 783:83a38bcfe7c8 trunk
[svn] - check the result of vfs_fread() strictly.
author | yaz |
---|---|
date | Mon, 05 Mar 2007 00:48:01 -0800 |
parents | 6f519e34ddf0 |
children | 5ddfe9eac8ee |
files | ChangeLog src/madplug/decoder.c src/madplug/input.c src/madplug/plugin.c |
diffstat | 4 files changed, 21 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Mar 05 00:28:52 2007 -0800 +++ b/ChangeLog Mon Mar 05 00:48:01 2007 -0800 @@ -1,3 +1,11 @@ +2007-03-05 08:28:52 +0000 William Pitcock <nenolod@sacredspiral.co.uk> + revision [1662] + - reject files which use Ogg container magic + + trunk/src/madplug/plugin.c | 2 ++ + 1 file changed, 2 insertions(+) + + 2007-03-05 01:32:01 +0000 Giacomo Lozito <james@develia.org> revision [1660] - aosd: remove no-longer-needed inclusion of pthread.h from aosd_osd.c
--- a/src/madplug/decoder.c Mon Mar 05 00:28:52 2007 -0800 +++ b/src/madplug/decoder.c Mon Mar 05 00:48:01 2007 -0800 @@ -195,7 +195,7 @@ while (1) { remainder = stream.bufend - stream.next_frame; - + /* if (remainder >= BUFFER_SIZE) { @@ -211,7 +211,7 @@ #ifdef DEBUG g_message("scan_file: len <= 0 abort."); #endif - break; + return 0; } mad_stream_buffer(&stream, buffer, len + remainder);
--- a/src/madplug/input.c Mon Mar 05 00:28:52 2007 -0800 +++ b/src/madplug/input.c Mon Mar 05 00:48:01 2007 -0800 @@ -557,9 +557,8 @@ /* simply read to data from the file */ len = vfs_fread(buffer, 1, buffer_size, info->infile); //vfs_fread returns num of elements. - if(len == 0){ - if(info->playback) - info->playback->eof = TRUE; + if(len == 0 && info->playback){ + info->playback->eof = TRUE; } #ifdef DEBUG
--- a/src/madplug/plugin.c Mon Mar 05 00:28:52 2007 -0800 +++ b/src/madplug/plugin.c Mon Mar 05 00:48:01 2007 -0800 @@ -224,6 +224,9 @@ guchar tmp[4096]; gint ret, i; + if (fin == NULL) + return 0; + info.remote = FALSE; if(audmad_is_remote(filename)) @@ -236,12 +239,10 @@ !strcasecmp("tta", ext) || !strcasecmp("ogg", ext) || !strcasecmp("wma", ext) ) ) - return FALSE; + return 0; - if (fin == NULL) - return FALSE; - - vfs_fread(buf, 1, 4, fin); + if(vfs_fread(buf, 1, 4, fin) == 0) + return 0; check = mp3_head_convert(buf); @@ -252,7 +253,8 @@ else if (memcmp(buf, "RIFF", 4) == 0) { vfs_fseek(fin, 4, SEEK_CUR); - vfs_fread(buf, 1, 4, fin); + if(vfs_fread(buf, 1, 4, fin) == 0) + return 0; if (memcmp(buf, "RMP3", 4) == 0) return 1; @@ -260,8 +262,7 @@ while (!mp3_head_check(check)) { - ret = vfs_fread(tmp, 1, 4096, fin); - if (ret == 0) + if(vfs_fread(tmp, 1, 4096, fin) == 0) return 0; for (i = 0; i < ret; i++)