aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264_slice.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2016-05-20 11:04:55 +0200
committerAnton Khirnov <anton@khirnov.net>2016-06-21 11:19:19 +0200
commitd1d7678040cd60148f97b372cb4291bcc45b2e22 (patch)
treea8fc5ba7d7e611e0f3baf29642a484d9f4d8bd46 /libavcodec/h264_slice.c
parentb13fc1e344011949929975a3451f78f226aa1de3 (diff)
downloadffmpeg-d1d7678040cd60148f97b372cb4291bcc45b2e22.tar.gz
h264: fix the check for mixed IDR/non-IDR slices
Diffstat (limited to 'libavcodec/h264_slice.c')
-rw-r--r--libavcodec/h264_slice.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 32180225fc..244640fa59 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1333,6 +1333,8 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
h->nb_mmco = sl->nb_mmco;
h->explicit_ref_marking = sl->explicit_ref_marking;
+ h->picture_idr = nal->type == H264_NAL_IDR_SLICE;
+
/* Set the frame properties/side data. Only done for the second field in
* field coded frames, since some SEI information is present for each field
* and is merged by the SEI parsing code. */
@@ -1599,6 +1601,11 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl,
}
}
+ if (h->picture_idr && nal->type != H264_NAL_IDR_SLICE) {
+ av_log(h->avctx, AV_LOG_ERROR, "Invalid mix of IDR and non-IDR slices\n");
+ return AVERROR_INVALIDDATA;
+ }
+
assert(h->mb_num == h->mb_width * h->mb_height);
if (sl->first_mb_addr << FIELD_OR_MBAFF_PICTURE(h) >= h->mb_num ||
sl->first_mb_addr >= h->mb_num) {