[FFmpeg-devel] [PATCH 1/2] avcodec/cbs_av1: ensure Sequence Header unit content is always reference counted

James Almer jamrial at gmail.com
Tue Sep 29 17:22:29 EEST 2020


Prevents a NULL pointer dereference.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/cbs_av1.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index c66757125f..aef8cf8e64 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -1043,6 +1043,10 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx,
             av_buffer_unref(&priv->sequence_header_ref);
             priv->sequence_header = NULL;
 
+            err = ff_cbs_make_unit_refcounted(ctx, unit);
+            if (err < 0)
+                return err;
+
             priv->sequence_header_ref = av_buffer_ref(unit->content_ref);
             if (!priv->sequence_header_ref)
                 return AVERROR(ENOMEM);
-- 
2.27.0



More information about the ffmpeg-devel mailing list