aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/cbs_av1.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2020-09-29 11:14:07 -0300
committerJames Almer <jamrial@gmail.com>2020-12-01 12:31:58 -0300
commit233a99e1915ef237d2ef298db97680c323dfdd23 (patch)
treefbf774b9c39c7661a735b24592d010cf2b8780e6 /libavcodec/cbs_av1.c
parent052b4c3481b034a6187ad0900f1aa3c73016144e (diff)
downloadffmpeg-233a99e1915ef237d2ef298db97680c323dfdd23.tar.gz
avcodec/cbs_av1: ensure Sequence Header unit content is always reference counted
Prevents a NULL pointer dereference. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/cbs_av1.c')
-rw-r--r--libavcodec/cbs_av1.c4
1 files changed, 4 insertions, 0 deletions
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);