]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/graphparser: Check allocations for success
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 22 Aug 2020 23:51:22 +0000 (01:51 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 23 Aug 2020 17:57:42 +0000 (19:57 +0200)
parse_filter() did not check the return value of av_get_token() for
success; in case name (the name of a filter) was NULL, one got a
segfault in av_strlcpy() (called from create_filter()).

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavfilter/graphparser.c

index e96b20418e786e9dbade459598f5a7e5be69bc06..a52916a1462e2f65e2dc69520b93e647f32ded38 100644 (file)
@@ -186,9 +186,16 @@ static int parse_filter(AVFilterContext **filt_ctx, const char **buf, AVFilterGr
     char *name = av_get_token(buf, "=,;[");
     int ret;
 
+    if (!name)
+        return AVERROR(ENOMEM);
+
     if (**buf == '=') {
         (*buf)++;
         opts = av_get_token(buf, "[],;");
+        if (!opts) {
+            av_free(name);
+            return AVERROR(ENOMEM);
+        }
     }
 
     ret = create_filter(filt_ctx, graph, index, name, opts, log_ctx);