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 ESMTP id 683B942844 for ; Sat, 4 Jun 2022 11:57:40 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BF80468B712; Sat, 4 Jun 2022 14:57:38 +0300 (EEST) Received: from shout02.mail.de (shout02.mail.de [62.201.172.25]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 270AF68B6AB for ; Sat, 4 Jun 2022 14:57:32 +0300 (EEST) Received: from postfix02.mail.de (postfix02.bt.mail.de [10.0.121.126]) by shout02.mail.de (Postfix) with ESMTP id C47ADA1CC7 for ; Sat, 4 Jun 2022 13:57:31 +0200 (CEST) Received: from smtp04.mail.de (smtp04.bt.mail.de [10.0.121.214]) by postfix02.mail.de (Postfix) with ESMTP id AA830A03C1 for ; Sat, 4 Jun 2022 13:57:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mailde202009; t=1654343851; bh=/G0CgK294PfGJw0WIpHHUwBaPvKkwhUfnIBIFEeWF14=; h=From:To:Subject:Date:Message-ID:From:To:CC:Subject:Reply-To; b=R417BPqfXPk90HExL1sEw2mneBwOGk2TTXl24tl6/qSOK/vUQfUe6Q6n4kBHnIBzL ZqAfoXmv6GUCK5W7XxdI+1jCnkVgYNAW5Rx78SugbKecpE5FVAxpzdn+2zYrVTK80m WNEvfNZe/NnhoxTV348n+KIVwJQLhmr+3/2ttfagWEUxPMu+qCx05yF0DzeX/NKspq MdDFqSSO3PyHtwAeA/WgGbQ6XnV1icRjBf2hVuopQhvgEcjMEEsprhcDT7mrYrT080 EZmBEzvCOpqBVLUIvHiFfd16xsUsiNm11yMnEmLm/dduuF+91EJOZS0uJbHDToXYz7 D6U/0BQeP/KdA== Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp04.mail.de (Postfix) with ESMTPSA id 79302C008D for ; Sat, 4 Jun 2022 13:57:31 +0200 (CEST) From: "Thilo Borgmann" To: "FFmpeg development discussions and patches" Date: Sat, 04 Jun 2022 13:57:25 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_MailMate_AE793571-C50F-4223-AA54-20F54CEC0EA4_=" Content-Transfer-Encoding: 8bit X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 1746 X-purgate-ID: 154282::1654343851-000016C9-FAA143D3/0/0 Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavfi/blockdetect: Fix possible div by 0 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --=_MailMate_AE793571-C50F-4223-AA54-20F54CEC0EA4_= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Now with actual patch… -Thilo --=_MailMate_AE793571-C50F-4223-AA54-20F54CEC0EA4_= Content-Disposition: attachment; filename=0001-lavfi-blockdetect-Fix-possible-div-by-0.patch Content-Type: text/plain Content-Transfer-Encoding: quoted-printable =46rom 25e875c330e76c2c6be30231e9730fa3a2f30115 Mon Sep 17 00:00:00 2001 From: Thilo Borgmann Date: Sat, 4 Jun 2022 13:45:30 +0200 Subject: [PATCH 1/2] lavfi/blockdetect: Fix possible div by 0 Found-by Covererity, CID 1504568, 1504569 --- libavfilter/vf_blockdetect.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavfilter/vf_blockdetect.c b/libavfilter/vf_blockdetect.c index 8503b8d..85fca68 100644 --- a/libavfilter/vf_blockdetect.c +++ b/libavfilter/vf_blockdetect.c @@ -132,8 +132,10 @@ static float calculate_blockiness(BLKContext *s, int= w, int h, nonblock_count++; } } + if (block_count && nonblock_count) { temp =3D (block / block_count) / (nonblock / nonblock_count); ret =3D FFMAX(ret, temp); + } } = // vertical blockiness (fixed height) @@ -175,8 +177,10 @@ static float calculate_blockiness(BLKContext *s, int= w, int h, nonblock_count++; } } + if (block_count && nonblock_count) { temp =3D (block / block_count) / (nonblock / nonblock_count); ret =3D FFMAX(ret, temp); + } } = // return highest value of horz||vert -- = 1.8.3.2 --=_MailMate_AE793571-C50F-4223-AA54-20F54CEC0EA4_= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --=_MailMate_AE793571-C50F-4223-AA54-20F54CEC0EA4_=--