[FFmpeg-devel] avfilter/vf_overlay_qsv: initialize default pix_fmt

Submitted by Linjie Fu on Nov. 5, 2018, 9:37 a.m.

Details

Message ID 20181105093702.31412-1-linjie.fu@intel.com
State New
Headers show

Commit Message

Linjie Fu Nov. 5, 2018, 9:37 a.m.
add default initiaization for pix_fmt in function have_alpha_panar
to avoid using uninitialized value.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
---
 libavfilter/vf_overlay_qsv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Zhong Li Nov. 5, 2018, 12:24 p.m.
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf

> Of Linjie Fu

> Sent: Monday, November 5, 2018 5:37 PM

> To: ffmpeg-devel@ffmpeg.org

> Cc: Fu, Linjie <linjie.fu@intel.com>

> Subject: [FFmpeg-devel] [PATCH] avfilter/vf_overlay_qsv: initialize default

> pix_fmt

> 

> add default initiaization for pix_fmt in function have_alpha_panar to avoid

> using uninitialized value.

> 

> Signed-off-by: Linjie Fu <linjie.fu@intel.com>

> ---

>  libavfilter/vf_overlay_qsv.c | 3 ++-

>  1 file changed, 2 insertions(+), 1 deletion(-)

> 

> diff --git a/libavfilter/vf_overlay_qsv.c b/libavfilter/vf_overlay_qsv.c index

> 20871786ee..79d6a58ec3 100644

> --- a/libavfilter/vf_overlay_qsv.c

> +++ b/libavfilter/vf_overlay_qsv.c

> @@ -167,7 +167,8 @@ static int have_alpha_planar(AVFilterLink *link)

>      if (link->format == AV_PIX_FMT_QSV) {

>          fctx    = (AVHWFramesContext *)link->hw_frames_ctx->data;

>          pix_fmt = fctx->sw_format;

> -    }

> +    } else

> +        pix_fmt = AV_PIX_FMT_NONE;

> 

>      desc = av_pix_fmt_desc_get(pix_fmt);

>      if (!desc)

> --

> 2.17.1


I believe https://patchwork.ffmpeg.org/patch/9069/ should be better (If nobody against, I prefer to merge it).

Patch hide | download patch | download mbox

diff --git a/libavfilter/vf_overlay_qsv.c b/libavfilter/vf_overlay_qsv.c
index 20871786ee..79d6a58ec3 100644
--- a/libavfilter/vf_overlay_qsv.c
+++ b/libavfilter/vf_overlay_qsv.c
@@ -167,7 +167,8 @@  static int have_alpha_planar(AVFilterLink *link)
     if (link->format == AV_PIX_FMT_QSV) {
         fctx    = (AVHWFramesContext *)link->hw_frames_ctx->data;
         pix_fmt = fctx->sw_format;
-    }
+    } else
+        pix_fmt = AV_PIX_FMT_NONE;
 
     desc = av_pix_fmt_desc_get(pix_fmt);
     if (!desc)