avcodec/m101: Check BPS value
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 18 May 2016 15:11:20 +0000 (17:11 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 18 May 2016 16:40:22 +0000 (18:40 +0200)
Fixes null pointer dereference
Fixes Ticket5520

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/m101.c

index f005670..05546fc 100644 (file)
@@ -31,9 +31,12 @@ static av_cold int m101_decode_init(AVCodecContext *avctx)
 
     if (avctx->extradata[2*4] == 10)
         avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
-    else
+    else if (avctx->extradata[2*4] == 8) {
         avctx->pix_fmt = AV_PIX_FMT_YUYV422;
-
+    } else {
+        avpriv_request_sample(avctx, "BPS %d\n", avctx->extradata[2*4]);
+        return AVERROR_INVALIDDATA;
+    }
 
     return 0;
 }