aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/modplug_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-24 19:16:33 +0100
committerMax Kellermann <max@duempel.org>2009-01-24 19:16:33 +0100
commit793934cf9c5d79365ca5c93ab05c8c2668d0ce7d (patch)
treeed8e34afd24a67821d2eb7dfefac0acf2574a5a3 /src/decoder/modplug_plugin.c
parent14b37656a653961703682ba8f3805cf7a21680b4 (diff)
downloadmpd-793934cf9c5d79365ca5c93ab05c8c2668d0ce7d.tar.gz
mpd-793934cf9c5d79365ca5c93ab05c8c2668d0ce7d.tar.xz
mpd-793934cf9c5d79365ca5c93ab05c8c2668d0ce7d.zip
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.
Diffstat (limited to 'src/decoder/modplug_plugin.c')
-rw-r--r--src/decoder/modplug_plugin.c10
1 files changed, 8 insertions, 2 deletions
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) {