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 71E7647135 for ; Mon, 27 Jan 2025 19:23:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2D6CB68BC89; Mon, 27 Jan 2025 21:23:36 +0200 (EET) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 87B7568BB2D for ; Mon, 27 Jan 2025 21:23:28 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 327B8EBB27 for ; Mon, 27 Jan 2025 20:24:06 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DAf7KWhV9e68 for ; Mon, 27 Jan 2025 20:24:04 +0100 (CET) Received: from iq (iq [217.27.212.140]) by iq.passwd.hu (Postfix) with ESMTPS id 33B8EEBB26 for ; Mon, 27 Jan 2025 20:24:04 +0100 (CET) Date: Mon, 27 Jan 2025 20:24:04 +0100 (CET) From: Marton Balint To: FFmpeg development discussions and patches In-Reply-To: <20250127052801.596-1-ffmpeg@gyani.pro> Message-ID: References: <20250127052801.596-1-ffmpeg@gyani.pro> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH] 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 Mon, 27 Jan 2025, Gyan Doshi wrote: > The ref input may have its frame rate unset, which would then lead to > SIGFPE. > > Related to #11428 > --- > libavfilter/vf_xpsnr.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/libavfilter/vf_xpsnr.c b/libavfilter/vf_xpsnr.c > index 1b2c2a7c2c..8f86c188c5 100644 > --- a/libavfilter/vf_xpsnr.c > +++ b/libavfilter/vf_xpsnr.c > @@ -568,7 +568,8 @@ 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) : 25; I kind of prefer 0 instead of 25, as far as I see the code does not care, and 0 is better than an arbitrary value. Thanks, Marton > > 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". > _______________________________________________ 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".