From: Anton Khirnov Date: Thu, 28 Nov 2013 09:54:35 +0000 (+0100) Subject: h264: check that an IDR NAL only contains I slices X-Git-Tag: android-x86-6.0-r1~10^2~2324 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8b2e5e42bb9d6a59ede5af2e6df4aaf7750d1195;p=android-x86%2Fexternal-ffmpeg.git h264: check that an IDR NAL only contains I slices Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org --- diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 6f329aacb3..4b10a68f03 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3383,6 +3383,12 @@ static int decode_slice_header(H264Context *h, H264Context *h0) h->slice_type = slice_type; h->slice_type_nos = slice_type & 3; + if (h->nal_unit_type == NAL_IDR_SLICE && + h->slice_type_nos != AV_PICTURE_TYPE_I) { + av_log(h->avctx, AV_LOG_ERROR, "A non-intra slice in an IDR NAL unit.\n"); + return AVERROR_INVALIDDATA; + } + // to make a few old functions happy, it's wrong though h->pict_type = h->slice_type;