[FFmpeg-cvslog] avfilter/vf_mix: Check sscanf() return value

Limin Wang git at videolan.org
Fri May 1 01:37:14 EEST 2020


ffmpeg | branch: master | Limin Wang <lance.lmwang at gmail.com> | Sun Mar 29 09:08:13 2020 +0800| [ee5d6d2ef88a3a7fd480435cf931dd6165bbb688] | committer: Limin Wang

avfilter/vf_mix: Check sscanf() return value

Reviewed-by: Nicolas George <george at nsup.org>
Signed-off-by: Limin Wang <lance.lmwang at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ee5d6d2ef88a3a7fd480435cf931dd6165bbb688
---

 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 f418c6fba8..bdb67d8e5a 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;
     }



More information about the ffmpeg-cvslog mailing list