I've been given a sample that does this. Not sure exactly why, but the decoder
ignores it and plays normally.
---
 libavcodec/hevc_mp4toannexb_bsf.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/hevc_mp4toannexb_bsf.c 
b/libavcodec/hevc_mp4toannexb_bsf.c
index 09bce5b34c..fb4ea34a93 100644
--- a/libavcodec/hevc_mp4toannexb_bsf.c
+++ b/libavcodec/hevc_mp4toannexb_bsf.c
@@ -52,6 +52,11 @@ static int hevc_extradata_to_annexb(AVBSFContext *ctx)
     num_arrays  = bytestream2_get_byte(&gb);
 
     for (i = 0; i < num_arrays; i++) {
+        if (bytestream2_get_bytes_left(&gb) < 3) {
+            av_log(ctx, AV_LOG_WARNING, "Extradata contained fewer arrays than 
indicated\n");
+            break;
+        }
+
         int type = bytestream2_get_byte(&gb) & 0x3f;
         int cnt  = bytestream2_get_be16(&gb);
 
-- 
2.18.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to