From 793934cf9c5d79365ca5c93ab05c8c2668d0ce7d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 24 Jan 2009 19:16:33 +0100 Subject: modplug: check for input_stream errors When input_stream_read() returns 0, and input_stream_eof() returns false, an I/O error has occured. Skip this song. --- src/decoder/modplug_plugin.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/decoder/modplug_plugin.c b/src/decoder/modplug_plugin.c index df5971b98..2c097836c 100644 --- a/src/decoder/modplug_plugin.c +++ b/src/decoder/modplug_plugin.c @@ -58,8 +58,14 @@ static GByteArray *mod_loadfile(struct decoder *decoder, struct input_stream *is do { ret = decoder_read(decoder, is, data, MODPLUG_READ_BLOCK); if (ret == 0) { - //end of file, or read error - break; + if (input_stream_eof(is)) + /* end of file */ + break; + + /* I/O error - skip this song */ + g_free(data); + g_byte_array_free(bdatas, true); + return NULL; } if (bdatas->len + ret > MODPLUG_FILE_LIMIT) { -- cgit v1.2.3