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/decoder | |
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 '')
-rw-r--r-- | src/decoder_api.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/decoder_api.c b/src/decoder_api.c index 08e6b1956..0aca4da95 100644 --- a/src/decoder_api.c +++ b/src/decoder_api.c @@ -106,6 +106,9 @@ size_t decoder_read(struct decoder *decoder, assert(is != NULL); assert(buffer != NULL); + if (length == 0) + return 0; + while (true) { /* XXX don't allow decoder==NULL */ if (decoder != NULL && |