Message ID | 20200929142230.3491-1-jamrial@gmail.com |
---|---|
State | Accepted |
Commit | 233a99e1915ef237d2ef298db97680c323dfdd23 |
Headers | show |
Series | [FFmpeg-devel,1/2] avcodec/cbs_av1: ensure Sequence Header unit content is always reference counted | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On 9/29/2020 11:22 AM, James Almer wrote: > Prevents a NULL pointer dereference. > > Signed-off-by: James Almer <jamrial@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.
On 9/29/2020 11:22 AM, James Almer wrote: > Missed in 0720e15c0330f0f101c02d5c2c6548e964079f6d. PS units are now guaranteed > to always be reference counter. > > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libavcodec/cbs_h2645.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c > index b6d77dd17f..434322492c 100644 > --- a/libavcodec/cbs_h2645.c > +++ b/libavcodec/cbs_h2645.c > @@ -671,8 +671,6 @@ static int cbs_h26 ## h26n ## _replace_ ## ps_var(CodedBitstreamContext *ctx, \ > if (!priv->ps_var ## _ref[id]) \ > return AVERROR(ENOMEM); \ > priv->ps_var[id] = (H26 ## h26n ## Raw ## ps_name *)priv->ps_var ## _ref[id]->data; \ > - if (!unit->content_ref) \ > - memcpy(priv->ps_var[id], ps_var, sizeof(*ps_var)); \ > return 0; \ > } Applied.
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);
Prevents a NULL pointer dereference. Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/cbs_av1.c | 4 ++++ 1 file changed, 4 insertions(+)