Decoding different pictures in different slice threads simultaneously
leads to all kinds of UB.

Bug-Id: 690
---
This has already been fixed in master during one of the refactoring rounds.
---
 libavcodec/h264_slice.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index c2c3e9f..8d4b342 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1216,6 +1216,12 @@ int ff_h264_decode_slice_header(H264Context *h, 
H264Context *h0)
         }
     }
 
+    if (!h0->current_slice && h != h0) {
+        av_log(h->avctx, AV_LOG_ERROR,
+               "A new picture can only be started in the first slice 
thread\n");
+        return AVERROR(ENOSYS);
+    }
+
     slice_type = get_ue_golomb_31(&h->gb);
     if (slice_type > 9) {
         av_log(h->avctx, AV_LOG_ERROR,
-- 
2.0.0

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to