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-02 12:48:04 -0500
commit979f77b0dc40571761999633a38d97be9a1670c8 (patch)
treec9eb9227b16288367e4f8142000d9c339aa5e7d7
parent2f4e066d66b37e48c6c11cc33649fb5c9656007d (diff)
downloadffmpeg-979f77b0dc40571761999633a38d97be9a1670c8.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> (cherry picked from commit 62ed6da016b789eee00e0fff517df4a254e12e5d) Signed-off-by: Reinhard Tartler <siretart@tauware.de> Conflicts: libavcodec/h264.c
-rw-r--r--libavcodec/h264.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index da865c6387..ff7859ce2b 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2688,7 +2688,14 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
h->slice_type= slice_type;
h->slice_type_nos= slice_type & 3;
- s->pict_type= h->slice_type; // to make a few old functions happy, it's wrong though
+ 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;
pps_id= get_ue_golomb(&s->gb);
if(pps_id>=MAX_PPS_COUNT){