Commit 507b01f8 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/h264_slice: Disable slice threads if there are multiple access units in a packet

Fixes null pointer dereference
Fixes Ticket4977
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 58346f6a
...@@ -1177,6 +1177,15 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl) ...@@ -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"); av_log(h->avctx, AV_LOG_ERROR, "Too many fields\n");
return AVERROR_INVALIDDATA; 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) { if (h->cur_pic_ptr && FIELD_PICTURE(h) && h->first_field) {
ret = ff_h264_field_end(h, h->slice_ctx, 1); ret = ff_h264_field_end(h, h->slice_ctx, 1);
h->current_slice = 0; h->current_slice = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment