aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-11-28 10:54:35 +0100
committerReinhard Tartler <siretart@tauware.de>2014-02-01 23:51:46 -0500
commit62ed6da016b789eee00e0fff517df4a254e12e5d (patch)
tree1bb9eaef5b7f03d9d9415148d8e5535a054fa961
parenta1b4d42d31ba700c97d4388153a2a553d71ca0ba (diff)
downloadffmpeg-62ed6da016b789eee00e0fff517df4a254e12e5d.tar.gz
h264: check that an IDR NAL only contains I slices
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org (cherry picked from commit 8b2e5e42bb9d6a59ede5af2e6df4aaf7750d1195) Signed-off-by: Reinhard Tartler <siretart@tauware.de>
-rw-r--r--libavcodec/h264.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 29c81966c9..b256969b6e 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2655,6 +2655,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->s.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
s->pict_type = h->slice_type;