From patchwork Fri Feb 5 11:27:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul B Mahol X-Patchwork-Id: 25451 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2588644B4D7 for ; Fri, 5 Feb 2021 13:28:16 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DC4FA689AEA; Fri, 5 Feb 2021 13:28:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 54CCE6880AA for ; Fri, 5 Feb 2021 13:28:09 +0200 (EET) Received: by mail-ej1-f45.google.com with SMTP id bl23so11396280ejb.5 for ; Fri, 05 Feb 2021 03:28:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=drAhG5kPrntKJvzDLuk0tNVtH9XVVupbZHwPds2a2hI=; b=L5WOHB/H20SPUzjlZLjzD43dqn5H4DgkUlJcm2mnPIK+8hxACzAV/nX/xKsDPXVXDs 3qlz5Cj+rnEaqhB7QT8F5TIS/3590WUFrLze7+FBIrIrBhM9SnrGoEv2do7VdcnSzDhL GffMMb4gkr5aALgrrlM3UJPOHmPpnyqelzL/Kk684K6uGGIVCXShsknKcrP6GvgGRFWu KP/+Z343SKVlyfkOpiAgo5dCwI6smNQebECCQTm+ME7LpTZtSRFrHVF8a1gm0gAsg5pF tqvIfRNHppq6EBPeq31vmuEL5yqmX9vqztsIKMtXhqNQPc6Yl267FS/K3+Y1suZhEhAg muUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=drAhG5kPrntKJvzDLuk0tNVtH9XVVupbZHwPds2a2hI=; b=QBAkDP3URinL7bc+TMCxOo0PzL16RI3b7/egPtfnrvGieUl2FHOl7Ph5BRrRoigdto xJ9p2SqBOkIJ8tpBo3ZEh001RDwAn6E5VLvJsrJbmI4bpuBmx86AiVxUWg+b8DIK4Xox C9c2F5aZRM5YhYnzGUVthoO/LYFPd9JiYyC1OXEfLHuqLkqWKNtCLldKERdwfYVakfDi ZH1qZMBm1BAtUwDmnJj9zJBdYX34MH4cDhgpPmPOgIy/HzzBzypaXy5T1kaISDcO2K4k +8O3+sJug8liz7ba1dYv7ohNyQt7FKrsbaZIkBSdXDyGzUfQ0lrqzogGFl5HBdI4YL3C e6pQ== X-Gm-Message-State: AOAM531KCFR2/k0OyqnJkqNFFSH4RBbUIha6Vsn76np/TGS7HzxPiaBg rNjSoghGrFQU+3Zjk0ITV38Z0s5BOKP8Jg== X-Google-Smtp-Source: ABdhPJyQcda5jp1FrpSp28fye+IZTe1xKjO04CDBsWReE5qMzU3zs9fE1IRjnu9OSb+Ao7MY//ZmXg== X-Received: by 2002:a17:906:d935:: with SMTP id rn21mr3616165ejb.443.1612524488679; Fri, 05 Feb 2021 03:28:08 -0800 (PST) Received: from localhost.localdomain ([31.45.254.141]) by smtp.gmail.com with ESMTPSA id a15sm3846402edy.86.2021.02.05.03.28.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 03:28:08 -0800 (PST) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Fri, 5 Feb 2021 12:27:59 +0100 Message-Id: <20210205112759.7338-1-onemda@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH] avfilter/avfilter: move enable_str expression parsing into avfilter_init_dict() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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). Signed-off-by: Paul B Mahol --- libavfilter/avfilter.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 4c52d83842..d560655f42 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -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; }