avcodec/vp8: Check bitstream input in vp7_fade_frame() before time consuming operation
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 24 Jun 2018 00:43:18 +0000 (02:43 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 11 Sep 2018 22:52:01 +0000 (00:52 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/vp8.c

index 3adfeac..a06692c 100644 (file)
@@ -507,6 +507,9 @@ static int vp7_fade_frame(VP8Context *s, VP56RangeCoder *c)
     int beta  = (int8_t) vp8_rac_get_uint(c, 8);
     int ret;
 
+    if (c->end <= c->buffer && c->bits >= 0)
+        return AVERROR_INVALIDDATA;
+
     if (!s->keyframe && (alpha || beta)) {
         int width  = s->mb_width * 16;
         int height = s->mb_height * 16;