Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] qsv: add return value check for MFXQueryIMPL
@ 2022-02-24  2:27 Tong Wu
  2022-02-24  2:27 ` [FFmpeg-devel] [PATCH] qsvenc: avoid dereferencing the null pointer Tong Wu
  2022-02-28  6:39 ` [FFmpeg-devel] [PATCH] qsv: add return value check for MFXQueryIMPL Xiang, Haihao
  0 siblings, 2 replies; 4+ messages in thread
From: Tong Wu @ 2022-02-24  2:27 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Tong Wu

add a return value check for function MFXQueryIMPL to handle the error
message.

Signed-off-by: Tong Wu <tong1.wu@intel.com>
---
 libavcodec/qsv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 1a432dbd82..18f34f05fd 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -408,7 +408,10 @@ int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
         return ret;
     }
 
-    MFXQueryIMPL(qs->session, &impl);
+    ret = MFXQueryIMPL(qs->session, &impl);
+    if (ret != MFX_ERR_NONE)
+        return ff_qsv_print_error(avctx, ret,
+                                  "Error querying the session attributes");
 
     switch (MFX_IMPL_BASETYPE(impl)) {
     case MFX_IMPL_SOFTWARE:
-- 
2.16.1.windows.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [FFmpeg-devel] [PATCH] qsvenc: avoid dereferencing the null pointer
  2022-02-24  2:27 [FFmpeg-devel] [PATCH] qsv: add return value check for MFXQueryIMPL Tong Wu
@ 2022-02-24  2:27 ` Tong Wu
  2022-02-28  6:39   ` Xiang, Haihao
  2022-02-28  6:39 ` [FFmpeg-devel] [PATCH] qsv: add return value check for MFXQueryIMPL Xiang, Haihao
  1 sibling, 1 reply; 4+ messages in thread
From: Tong Wu @ 2022-02-24  2:27 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Tong Wu

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;
-- 
2.16.1.windows.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH] qsv: add return value check for MFXQueryIMPL
  2022-02-24  2:27 [FFmpeg-devel] [PATCH] qsv: add return value check for MFXQueryIMPL Tong Wu
  2022-02-24  2:27 ` [FFmpeg-devel] [PATCH] qsvenc: avoid dereferencing the null pointer Tong Wu
@ 2022-02-28  6:39 ` Xiang, Haihao
  1 sibling, 0 replies; 4+ messages in thread
From: Xiang, Haihao @ 2022-02-28  6:39 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Wu, Tong1

On Thu, 2022-02-24 at 10:27 +0800, Tong Wu wrote:
> add a return value check for function MFXQueryIMPL to handle the error
> message.
> 
> Signed-off-by: Tong Wu <tong1.wu@intel.com>
> ---
>  libavcodec/qsv.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
> index 1a432dbd82..18f34f05fd 100644
> --- a/libavcodec/qsv.c
> +++ b/libavcodec/qsv.c
> @@ -408,7 +408,10 @@ int ff_qsv_init_internal_session(AVCodecContext *avctx,
> QSVSession *qs,
>          return ret;
>      }
>  
> -    MFXQueryIMPL(qs->session, &impl);
> +    ret = MFXQueryIMPL(qs->session, &impl);
> +    if (ret != MFX_ERR_NONE)
> +        return ff_qsv_print_error(avctx, ret,
> +                                  "Error querying the session attributes");
>  
>      switch (MFX_IMPL_BASETYPE(impl)) {
>      case MFX_IMPL_SOFTWARE:

LGTM, applied

-Haihao

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH] qsvenc: avoid dereferencing the null pointer
  2022-02-24  2:27 ` [FFmpeg-devel] [PATCH] qsvenc: avoid dereferencing the null pointer Tong Wu
@ 2022-02-28  6:39   ` Xiang, Haihao
  0 siblings, 0 replies; 4+ messages in thread
From: Xiang, Haihao @ 2022-02-28  6:39 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Wu, Tong1

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

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-28  6:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24  2:27 [FFmpeg-devel] [PATCH] qsv: add return value check for MFXQueryIMPL Tong Wu
2022-02-24  2:27 ` [FFmpeg-devel] [PATCH] qsvenc: avoid dereferencing the null pointer Tong Wu
2022-02-28  6:39   ` Xiang, Haihao
2022-02-28  6:39 ` [FFmpeg-devel] [PATCH] qsv: add return value check for MFXQueryIMPL Xiang, Haihao

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git