[FFmpeg-devel] [PATCH v2 3/3] avfilter/af_adelay: Check sscanf() return value

lance.lmwang at gmail.com lance.lmwang at gmail.com
Sat Mar 28 02:17:33 EET 2020


From: Limin Wang <lance.lmwang at gmail.com>

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

diff --git a/libavfilter/af_adelay.c b/libavfilter/af_adelay.c
index c964777..2bb05e7 100644
--- a/libavfilter/af_adelay.c
+++ b/libavfilter/af_adelay.c
@@ -155,7 +155,10 @@ static int config_input(AVFilterLink *inlink)
         ret = av_sscanf(arg, "%d%c", &d->delay, &type);
         if (ret != 2 || type != 'S') {
             div = type == 's' ? 1.0 : 1000.0;
-            av_sscanf(arg, "%f", &delay);
+            if (av_sscanf(arg, "%f", &delay) != 1) {
+                av_log(ctx, AV_LOG_ERROR, "Invalid syntax.\n");
+                return AVERROR(EINVAL);
+            }
             d->delay = delay * inlink->sample_rate / div;
         }
 
-- 
2.9.5



More information about the ffmpeg-devel mailing list