From 42ee137a0a7d025f77964e38b438d00095e6dd11 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 18 May 2016 17:11:20 +0200 Subject: [PATCH] avcodec/m101: Check BPS value Fixes null pointer dereference Fixes Ticket5520 Signed-off-by: Michael Niedermayer --- libavcodec/m101.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/m101.c b/libavcodec/m101.c index f005670ed1..05546fcbe2 100644 --- a/libavcodec/m101.c +++ b/libavcodec/m101.c @@ -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; }