loco: check the last plane too
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 24 Feb 2013 12:03:13 +0000 (13:03 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 24 Feb 2013 12:08:52 +0000 (13:08 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/loco.c

index 559f7c2..e21e693 100644 (file)
@@ -240,10 +240,14 @@ static int decode_frame(AVCodecContext *avctx,
         break;
     }
 
         break;
     }
 
+    if (decoded < 0 || decoded > buf_size)
+        goto buf_too_small;
+    buf_size -= decoded;
+
     *got_frame      = 1;
     *(AVFrame*)data = l->pic;
 
     *got_frame      = 1;
     *(AVFrame*)data = l->pic;
 
-    return buf_size < 0 ? -1 : avpkt->size - buf_size;
+    return avpkt->size - buf_size;
 buf_too_small:
     av_log(avctx, AV_LOG_ERROR, "Input data too small.\n");
     return AVERROR(EINVAL);
 buf_too_small:
     av_log(avctx, AV_LOG_ERROR, "Input data too small.\n");
     return AVERROR(EINVAL);