]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/avfilter: move enable_str expression parsing into avfilter_init_dict()
authorPaul B Mahol <onemda@gmail.com>
Fri, 5 Feb 2021 11:23:57 +0000 (12:23 +0100)
committerPaul B Mahol <onemda@gmail.com>
Sat, 6 Feb 2021 10:40:59 +0000 (11:40 +0100)
This ensures that needed arrays are always allocated and properly initialized.

Previously if code would use only avfilter_init_dict() to set options for filters
it would not allocate arrays for timeline processing thus it would crash if
user supplied enable option for filter(s).

libavfilter/avfilter.c

index 4c52d838428b3fac12c8f2247e26b38bb8b58bc0..d560655f426eb7686c1827bdcfcf0b5777e36150 100644 (file)
@@ -875,11 +875,6 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options,
         count++;
     }
 
-    if (ctx->enable_str) {
-        ret = set_enable_expr(ctx, ctx->enable_str);
-        if (ret < 0)
-            return ret;
-    }
     return count;
 }
 
@@ -930,6 +925,12 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
     else if (ctx->filter->init_dict)
         ret = ctx->filter->init_dict(ctx, options);
 
+    if (ctx->enable_str) {
+        ret = set_enable_expr(ctx, ctx->enable_str);
+        if (ret < 0)
+            return ret;
+    }
+
     return ret;
 }