[FFmpeg-devel] [PATCH] qsvenc: avoid dereferencing the null pointer

Tong Wu tong1.wu at intel.com
Thu Feb 24 04:27:40 EET 2022


The variable AVFrame *frame could be a null pointer, now add a null
pointer check to avoid dereferencing the null pointer.

Signed-off-by: Tong Wu <tong1.wu at intel.com>
---
 libavcodec/qsvenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 07be4287b7..998e43753e 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1726,7 +1726,7 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q,
         goto free;
     }
 
-    if (ret == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM && frame->interlaced_frame)
+    if (ret == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM && frame && frame->interlaced_frame)
         print_interlace_msg(avctx, q);
 
     ret = 0;
-- 
2.16.1.windows.4



More information about the ffmpeg-devel mailing list