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 C51C64BCC1 for ; Sun, 2 Feb 2025 17:57:47 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4BFBA68C07A; Sun, 2 Feb 2025 19:57:43 +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 9521C68BCF2 for ; Sun, 2 Feb 2025 19:57:37 +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 4YmHQk5Kbyz9t2F for ; Sun, 2 Feb 2025 18:57:34 +0100 (CET) From: Gyan Doshi To: ffmpeg-devel@ffmpeg.org Date: Sun, 2 Feb 2025 23:27:07 +0530 Message-ID: <20250202175707.773-1-ffmpeg@gyani.pro> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4YmHQk5Kbyz9t2F Subject: [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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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 --- 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); -- 2.46.1 _______________________________________________ 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".