diff mbox

[FFmpeg-devel,3/9] lavc/vaapi_decode: fix uninitialized use of variables

Message ID 20171108181753.6776-4-timo@rothenpieler.org
State New
Headers show

Commit Message

Timo Rothenpieler Nov. 8, 2017, 6:17 p.m. UTC
Fixes CID #1419524 and #1412855
---
 libavcodec/vaapi_decode.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Mark Thompson Nov. 8, 2017, 11:25 p.m. UTC | #1
On 08/11/17 18:17, Timo Rothenpieler wrote:
> Fixes CID #1419524 and #1412855
> ---
>  libavcodec/vaapi_decode.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
> index 27ef33837c..a782cfd8da 100644
> --- a/libavcodec/vaapi_decode.c
> +++ b/libavcodec/vaapi_decode.c
> @@ -281,8 +281,9 @@ static int vaapi_decode_make_config(AVCodecContext *avctx)
>      VAStatus vas;
>      int err, i, j;
>      const AVCodecDescriptor *codec_desc;
> -    VAProfile profile, va_profile, *profile_list = NULL;
> -    int profile_count, exact_match, alt_profile;
> +    VAProfile va_profile = VAProfileNone;
> +    VAProfile profile, *profile_list = NULL;
> +    int profile_count, exact_match, alt_profile = 0;
>      const AVPixFmtDescriptor *sw_desc, *desc;
>  
>      codec_desc = avcodec_descriptor_get(avctx->codec_id);
> 

No - you're just hiding the bug by spuriously initialising the variables involved.  I'll rewrite this section to be clearer and not have this bug.

- Mark
diff mbox

Patch

diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
index 27ef33837c..a782cfd8da 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -281,8 +281,9 @@  static int vaapi_decode_make_config(AVCodecContext *avctx)
     VAStatus vas;
     int err, i, j;
     const AVCodecDescriptor *codec_desc;
-    VAProfile profile, va_profile, *profile_list = NULL;
-    int profile_count, exact_match, alt_profile;
+    VAProfile va_profile = VAProfileNone;
+    VAProfile profile, *profile_list = NULL;
+    int profile_count, exact_match, alt_profile = 0;
     const AVPixFmtDescriptor *sw_desc, *desc;
 
     codec_desc = avcodec_descriptor_get(avctx->codec_id);