diff options
author | Max Kellermann <max@duempel.org> | 2008-11-15 19:27:30 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-11-15 19:27:30 +0100 |
commit | acfba02310a1b8159440dd71bdf7c7fefb7ef8fb (patch) | |
tree | a791b34bff1bf2bf24130f91a5efcf4da4a04eb2 /src/input_stream.c | |
parent | c368a2f91cd90083b4e4e1426182cf7b7a2a6d21 (diff) | |
download | mpd-acfba02310a1b8159440dd71bdf7c7fefb7ef8fb.tar.gz mpd-acfba02310a1b8159440dd71bdf7c7fefb7ef8fb.tar.xz mpd-acfba02310a1b8159440dd71bdf7c7fefb7ef8fb.zip |
decoder: check length==0 in decoder_read()
When the caller passes length==0, decoder_read() entered an endless
loop. Check that condition before entering the "while" loop.
Diffstat (limited to 'src/input_stream.c')
-rw-r--r-- | src/input_stream.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/input_stream.c b/src/input_stream.c index 86c0b9246..be547912e 100644 --- a/src/input_stream.c +++ b/src/input_stream.c @@ -26,6 +26,7 @@ #endif #include <glib.h> +#include <assert.h> static const struct input_plugin *const input_plugins[] = { &input_plugin_file, @@ -84,6 +85,9 @@ input_stream_seek(struct input_stream *is, off_t offset, int whence) size_t input_stream_read(struct input_stream *is, void *ptr, size_t size) { + assert(ptr != NULL); + assert(size > 0); + return is->plugin->read(is, ptr, size); } |