[FFmpeg-cvslog] avcodec/cbs_av1: ensure Sequence Header unit content is always reference counted

James Almer git at videolan.org
Tue Dec 1 17:39:29 EET 2020


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Sep 29 11:14:07 2020 -0300| [233a99e1915ef237d2ef298db97680c323dfdd23] | committer: James Almer

avcodec/cbs_av1: ensure Sequence Header unit content is always reference counted

Prevents a NULL pointer dereference.

Signed-off-by: James Almer <jamrial at gmail.com>

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

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

diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index 9ae2f59872..a40c91adff 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -1076,6 +1076,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);



More information about the ffmpeg-cvslog mailing list