[FFmpeg-devel] [PATCH] lavc/videotoolbox: validate vt context in the decoder callback

Rick Kern kernrj at gmail.com
Sun Dec 4 17:00:43 EET 2022


On Tue, Nov 29, 2022 at 11:47 AM Alessandro Di Nepi <
alessandro.dinepi at gmail.com> wrote:

> Just to add that this fix, once approved, should be cherry-picked to all
> the release branches where d7f4ad88a0df3c1339e142957bf2c40cd056b8ce has
> been cherry-picked.
> Basically, 4.4, 5.0, and 5.1.
>
> Thanks
> On 27 Nov 2022, 19:34 +0200, Alessandro Di Nepi <
> alessandro.dinepi at gmail.com>, wrote:
> > The commit d7f4ad88a0df3c1339e142957bf2c40cd056b8ce introduced a race
> > condition where the passed opaque pointer reference might be NULL,
> > when the decoding process starts.
> > This patch checks that vtctx has a value before accessing it.
> >
> > This patch fixes #10079.
> >
> > Signed-off-by: Alessandro Di Nepi <alessandro.dinepi at gmail.com>
> > ---
> > libavcodec/videotoolbox.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> > index 1b1be8ddb4..615e2b087a 100644
> > --- a/libavcodec/videotoolbox.c
> > +++ b/libavcodec/videotoolbox.c
> > @@ -692,6 +692,11 @@ static void videotoolbox_decoder_callback(void
> *opaque,
> > {
> > VTContext *vtctx = opaque;
> >
> > + if (!vtctx) {
>

When this happens, does it continue happening, or is it transient? My main
concern is log spamming.


> > + av_log(NULL, AV_LOG_WARNING, "vt decoder cb: vt context is null");
> > + return;
> > + }
> > +
> > if (vtctx->frame) {
> > CVPixelBufferRelease(vtctx->frame);
> > vtctx->frame = NULL;
> > --
> > 2.37.1 (Apple Git-137.1)
> >
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list