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

James Almer jamrial at gmail.com
Tue Dec 1 16:50:12 EET 2020


On 9/29/2020 11:22 AM, James Almer wrote:
> 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);

Will apply.


More information about the ffmpeg-devel mailing list