From patchwork Wed Dec 4 10:39:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 16585 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 B84FE44AC06 for ; Wed, 4 Dec 2019 12:39:14 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9B97D68B1A3; Wed, 4 Dec 2019 12:39:14 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6409168B155 for ; Wed, 4 Dec 2019 12:39:08 +0200 (EET) Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 47Sb1l5n6YzKmfx for ; Wed, 4 Dec 2019 11:39:07 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id LskEOjwT_ZBt for ; Wed, 4 Dec 2019 11:39:04 +0100 (CET) To: FFmpeg development discussions and patches From: Gyan Message-ID: <93818cad-46f2-f5ee-9b0b-ae40c2986d16@gyani.pro> Date: Wed, 4 Dec 2019 16:09:02 +0530 MIME-Version: 1.0 Content-Language: en-US Subject: [FFmpeg-devel] [PATCH] avfilter/crop: avoid premature eval error 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Valid width expressions were being rejected. Regards, Gyan From be3aacc114a0b2b6c8ec9e8b73be38f414ecbb3d Mon Sep 17 00:00:00 2001 From: Gyan Doshi Date: Wed, 4 Dec 2019 16:03:11 +0530 Subject: [PATCH] avfilter/crop: avoid premature eval error Width and height expressions can refer to each other. Width is evaluated twice to allow for reference to output height. So we should not error out upon failure of first evaluation of width. --- libavfilter/vf_crop.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c index d6b4feb513..9bf4077c5d 100644 --- a/libavfilter/vf_crop.c +++ b/libavfilter/vf_crop.c @@ -174,10 +174,9 @@ static int config_input(AVFilterLink *link) s->vsub = pix_desc->log2_chroma_h; } - if ((ret = av_expr_parse_and_eval(&res, (expr = s->w_expr), - var_names, s->var_values, - NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0) - goto fail_expr; + av_expr_parse_and_eval(&res, (expr = s->w_expr), + var_names, s->var_values, + NULL, NULL, NULL, NULL, NULL, 0, ctx); s->var_values[VAR_OUT_W] = s->var_values[VAR_OW] = res; if ((ret = av_expr_parse_and_eval(&res, (expr = s->h_expr), var_names, s->var_values,