rv10: check that extradata is large enough
authorAnton Khirnov <anton@khirnov.net>
Tue, 9 Apr 2013 18:33:25 +0000 (20:33 +0200)
committerReinhard Tartler <siretart@tauware.de>
Thu, 9 May 2013 18:05:53 +0000 (20:05 +0200)
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org

(cherry picked from commit 01d376f598fe95478036f5d1e3e5e14ffe32d4bf)

Conflicts:

libavcodec/rv10.c

libavcodec/rv10.c

index 8d5b62f..bd58dec 100644 (file)
@@ -345,6 +345,11 @@ static int rv20_decode_picture_header(MpegEncContext *s)
         f= get_bits(&s->gb, av_log2(v)+1);
 
         if(f){
+            if (s->avctx->extradata_size < 8 + 2 * f) {
+                av_log(s->avctx, AV_LOG_ERROR, "Extradata too small.\n");
+                return AVERROR_INVALIDDATA;
+            }
+
             new_w= 4*((uint8_t*)s->avctx->extradata)[6+2*f];
             new_h= 4*((uint8_t*)s->avctx->extradata)[7+2*f];
         }else{