[FFmpeg-cvslog] avcodec/hevcdec: decode at most one slice reporting being the first in the picture

James Almer git at videolan.org
Thu Mar 21 03:46:47 EET 2019


ffmpeg | branch: release/3.2 | James Almer <jamrial at gmail.com> | Mon Mar 18 17:25:58 2019 -0300| [a06cd0283eeadccff7a0e8a9214c01e816cfcad2] | committer: James Almer

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 at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>
(cherry picked from commit 70c8c8a818f39bc262565ec29fae2baffb3e1660)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a06cd0283eeadccff7a0e8a9214c01e816cfcad2
---

 libavcodec/hevc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index f8aeb63aa1..eb052b55ea 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -2795,6 +2795,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;



More information about the ffmpeg-cvslog mailing list