diff options
author | James Almer <jamrial@gmail.com> | 2019-03-18 17:25:58 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2019-03-20 20:28:04 -0300 |
commit | dbef08b60f44469228d37c63ede587490492acb2 (patch) | |
tree | a404fb83f6fa6ab541ebd23aff2fe05494817ab8 /libavcodec | |
parent | 77d244e7a937bf7e491d1783013e6b5a7c2ef797 (diff) | |
download | ffmpeg-dbef08b60f44469228d37c63ede587490492acb2.tar.gz |
avcodec/hevcdec: decode at most one slice reporting being the first in the picture
Fixes deadlocks when decoding packets containing more than one of the aforementioned
slices when using frame threads.
Tested-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 70c8c8a818f39bc262565ec29fae2baffb3e1660)
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/hevcdec.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index a3b5c8cb71..0dee673dac 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -2924,6 +2924,10 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) } if (s->sh.first_slice_in_pic_flag) { + if (s->ref) { + av_log(s->avctx, AV_LOG_ERROR, "Two slices reporting being the first in the same frame.\n"); + goto fail; + } if (s->max_ra == INT_MAX) { if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) { s->max_ra = s->poc; |