[FFmpeg-devel] [PATCH] lavc/videotoolbox: validate vt context in the decoder callback
Alessandro Di Nepi
alessandro.dinepi at gmail.com
Tue Nov 29 18:46:52 EET 2022
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) {
> + 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)
>
More information about the ffmpeg-devel
mailing list