diff mbox series

[FFmpeg-devel,v3,2/3] avfilter/vf_mix: Check sscanf() return value

Message ID 20200329010813.23547-1-lance.lmwang@gmail.com
State Accepted
Commit ee5d6d2ef88a3a7fd480435cf931dd6165bbb688
Headers show
Series None | expand

Commit Message

Lance Wang March 29, 2020, 1:08 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavfilter/vf_mix.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Lance Wang April 30, 2020, 9:30 p.m. UTC | #1
will apply the patchset 2 and 3.

On Sun, Mar 29, 2020 at 09:08:13AM +0800, lance.lmwang@gmail.com wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavfilter/vf_mix.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_mix.c b/libavfilter/vf_mix.c
> index 9e1ae79..9bb1b7a 100644
> --- a/libavfilter/vf_mix.c
> +++ b/libavfilter/vf_mix.c
> @@ -108,7 +108,10 @@ static av_cold int init(AVFilterContext *ctx)
>              break;
>  
>          p = NULL;
> -        av_sscanf(arg, "%f", &s->weights[i]);
> +        if (av_sscanf(arg, "%f", &s->weights[i]) != 1) {
> +            av_log(ctx, AV_LOG_ERROR, "Invalid syntax for weights[%d].\n", i);
> +            return AVERROR(EINVAL);
> +        }
>          s->wfactor += s->weights[i];
>          last = i;
>      }
> -- 
> 2.9.5
>
diff mbox series

Patch

diff --git a/libavfilter/vf_mix.c b/libavfilter/vf_mix.c
index 9e1ae79..9bb1b7a 100644
--- a/libavfilter/vf_mix.c
+++ b/libavfilter/vf_mix.c
@@ -108,7 +108,10 @@  static av_cold int init(AVFilterContext *ctx)
             break;
 
         p = NULL;
-        av_sscanf(arg, "%f", &s->weights[i]);
+        if (av_sscanf(arg, "%f", &s->weights[i]) != 1) {
+            av_log(ctx, AV_LOG_ERROR, "Invalid syntax for weights[%d].\n", i);
+            return AVERROR(EINVAL);
+        }
         s->wfactor += s->weights[i];
         last = i;
     }