lavc/bintext: check extradata size
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 9 Jun 2012 13:03:04 +0000 (15:03 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 9 Jun 2012 13:04:12 +0000 (15:04 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/bintext.c

index 463e4ac..e4507e5 100644 (file)
@@ -54,6 +54,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
         s->font_height = p[0];
         s->flags = p[1];
         p += 2;
+        if(avctx->extradata_size < 2 + (!!(s->flags & BINTEXT_PALETTE))*3*16
+                                     + (!!(s->flags & BINTEXT_FONT))*s->font_height*256) {
+            av_log(avctx, AV_LOG_ERROR, "not enough extradata\n");
+            return AVERROR_INVALIDDATA;
+        }
     } else {
         s->font_height = 8;
         s->flags = 0;