diff mbox series

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

Message ID 20220224022740.58216-2-tong1.wu@intel.com
State Accepted
Commit a0a2ccd55d2038867b0677c31f70632a69f6e9e3
Headers show
Series [FFmpeg-devel] qsvenc: avoid dereferencing the null pointer | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_aarch64_jetson success Make finished
andriy/make_fate_aarch64_jetson success Make fate finished
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Wu, Tong1 Feb. 24, 2022, 2:27 a.m. UTC
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@intel.com>
---
 libavcodec/qsvenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Xiang, Haihao Feb. 28, 2022, 6:39 a.m. UTC | #1
On Thu, 2022-02-24 at 10:27 +0800, Tong Wu wrote:
> 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@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;

LGTM, applied

-Haihao
diff mbox series

Patch

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;