OSDN Git Service

webp: Make sure enough bytes are available
authorAndreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Thu, 2 Jul 2015 23:14:51 +0000 (01:14 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Thu, 2 Jul 2015 23:50:09 +0000 (01:50 +0200)
Every chunk needs at least 8 bytes for chunk_type and chunk_size.
Prevent a possible infinite loop.

CC: libav-stable@libav.org
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
libavcodec/webp.c

index 62f35f7..4138e54 100644 (file)
@@ -1362,7 +1362,7 @@ static int webp_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
         return AVERROR_INVALIDDATA;
     }
 
-    while (bytestream2_get_bytes_left(&gb) > 0) {
+    while (bytestream2_get_bytes_left(&gb) > 8) {
         char chunk_str[5] = { 0 };
 
         chunk_type = bytestream2_get_le32(&gb);