aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2019-03-18 17:25:58 -0300
committerJames Almer <jamrial@gmail.com>2019-03-20 22:09:31 -0300
commitf8e254716b622926d781bc4b20ee53537bd174c4 (patch)
tree01dc6b2876d3c0ed147be79b5eda7aab49a8e97b
parent7653e8db4deb063ffbbfb9c14ed60f9bb56acff0 (diff)
downloadffmpeg-f8e254716b622926d781bc4b20ee53537bd174c4.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)
-rw-r--r--libavcodec/hevc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index c1fa67f67b..de734310dc 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -2792,6 +2792,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;
+ }
ret = hevc_frame_start(s);
if (ret < 0)
return ret;