[FFmpeg-cvslog] avcodec/vaapi_encode: Check hwctx
Michael Niedermayer
git at videolan.org
Thu Aug 1 03:08:34 EEST 2024
ffmpeg | branch: release/4.2 | Michael Niedermayer <michael at niedermayer.cc> | Fri Jul 19 22:29:15 2024 +0200| [4e5b5a06d728acb5ba1e298b4530a0ad9ba1d0fd] | committer: Michael Niedermayer
avcodec/vaapi_encode: Check hwctx
Fixes: null pointer dereference
Fixes: 70376/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_VAAPI_fuzzer-4733551250046976
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 3cd077e2820679e8b9f8eb10954b4f5701191c48)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4e5b5a06d728acb5ba1e298b4530a0ad9ba1d0fd
---
libavcodec/vaapi_encode.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index dd2a24de04..707cb63f7e 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -2253,12 +2253,14 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
av_buffer_pool_uninit(&ctx->output_buffer_pool);
if (ctx->va_context != VA_INVALID_ID) {
- vaDestroyContext(ctx->hwctx->display, ctx->va_context);
+ if (ctx->hwctx)
+ vaDestroyContext(ctx->hwctx->display, ctx->va_context);
ctx->va_context = VA_INVALID_ID;
}
if (ctx->va_config != VA_INVALID_ID) {
- vaDestroyConfig(ctx->hwctx->display, ctx->va_config);
+ if (ctx->hwctx)
+ vaDestroyConfig(ctx->hwctx->display, ctx->va_config);
ctx->va_config = VA_INVALID_ID;
}
More information about the ffmpeg-cvslog
mailing list