aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-10-31 21:36:00 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-10-31 22:57:52 +0100
commitaa34146e41b74d1db42239d0860537f55fca95b9 (patch)
treec072a932d260dc269479362924a84b777f87dd53
parentfcb8ee98f686e86a9adc7df22756136fe423b502 (diff)
downloadffmpeg-aa34146e41b74d1db42239d0860537f55fca95b9.tar.gz
avcodec/h264_slice: Disable slice threads if there are multiple access units in a packet
Fixes null pointer dereference Fixes part of Ticket4977 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 9368d2da3d33cac845f2fdf663df500b53625c5e) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/h264_slice.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index a346ccbc00..9642dc55d6 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1177,6 +1177,15 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
av_log(h->avctx, AV_LOG_ERROR, "Too many fields\n");
return AVERROR_INVALIDDATA;
}
+ if (h->max_contexts > 1) {
+ if (!h->single_decode_warning) {
+ av_log(h->avctx, AV_LOG_WARNING, "Cannot decode multiple access units as slice threads\n");
+ h->single_decode_warning = 1;
+ }
+ h->max_contexts = 1;
+ return SLICE_SINGLETHREAD;
+ }
+
if (h->cur_pic_ptr && FIELD_PICTURE(h) && h->first_field) {
ret = ff_h264_field_end(h, h->slice_ctx, 1);
h->current_slice = 0;