From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 967014C002 for ; Wed, 5 Feb 2025 06:39:52 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 327D768AFF3; Wed, 5 Feb 2025 08:39:48 +0200 (EET) Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 79CFC68AFF3 for ; Wed, 5 Feb 2025 08:39:41 +0200 (EET) Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4YnrF70C5Qz9tS3 for ; Wed, 5 Feb 2025 07:39:39 +0100 (CET) Message-ID: <9654deca-aa9e-43e2-a069-93fe8d62ec3e@gyani.pro> Date: Wed, 5 Feb 2025 12:09:37 +0530 MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org References: <20250202175707.773-1-ffmpeg@gyani.pro> Content-Language: en-US From: Gyan Doshi In-Reply-To: <20250202175707.773-1-ffmpeg@gyani.pro> X-Rspamd-Queue-Id: 4YnrF70C5Qz9tS3 Subject: Re: [FFmpeg-devel] [PATCH v2] avfilter/xpsnr: avoid division by zero X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 2025-02-02 11:27 pm, Gyan Doshi wrote: > The ref input may have its frame rate unset, which would then lead to > SIGFPE. So fall back to the main link frame rate. If that too is unset, > default to 0. > > Related to #11428 Plan to push tomorrow. Regards, Gyan > --- > libavfilter/vf_xpsnr.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/libavfilter/vf_xpsnr.c b/libavfilter/vf_xpsnr.c > index 1b2c2a7c2c..3097db0878 100644 > --- a/libavfilter/vf_xpsnr.c > +++ b/libavfilter/vf_xpsnr.c > @@ -552,6 +552,7 @@ static int config_input_ref(AVFilterLink *inlink) > AVFilterContext *ctx = inlink->dst; > XPSNRContext *const s = ctx->priv; > FilterLink *il = ff_filter_link(inlink); > + FilterLink *ml = ff_filter_link(ctx->inputs[0]); > > if ((ctx->inputs[0]->w != ctx->inputs[1]->w) || > (ctx->inputs[0]->h != ctx->inputs[1]->h)) { > @@ -568,7 +569,9 @@ static int config_input_ref(AVFilterLink *inlink) > s->max_error_64 = (1 << s->depth) - 1; /* conventional limit */ > s->max_error_64 *= s->max_error_64; > > - s->frame_rate = il->frame_rate.num / il->frame_rate.den; > + // Avoid division by zero > + s->frame_rate = il->frame_rate.den ? (il->frame_rate.num / il->frame_rate.den) : > + ml->frame_rate.den ? (ml->frame_rate.num / ml->frame_rate.den) : 0; > > s->num_comps = (desc->nb_components > 3 ? 3 : desc->nb_components); > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".