[FFmpeg-devel] [PATCH] lavc/qsvenc: add NULL pointer check for frame before use

Linjie Fu linjie.fu at intel.com
Tue Jan 21 10:42:19 EET 2020


Null Frame would be sent to MSDK to flush the encoder, hence add
a NULL check before using frame->interlaced_frame to prevent the
potential crash, regardless of the return value of
MFXVideoENCODE_EncodeFrameAsync().

Signed-off-by: Linjie Fu <linjie.fu 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 9e41650..2dfe107 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1481,7 +1481,7 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q,
                0 : ff_qsv_print_error(avctx, ret, "Error during encoding");
     }
 
-    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);
 
     if (*sync) {
-- 
2.7.4



More information about the ffmpeg-devel mailing list