Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/2] lavfi/blockdetect: Fix possible div by 0
@ 2022-06-04 11:54 Thilo Borgmann
  2022-06-04 11:56 ` Andreas Rheinhardt
  2022-06-04 11:57 ` Thilo Borgmann
  0 siblings, 2 replies; 6+ messages in thread
From: Thilo Borgmann @ 2022-06-04 11:54 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Hi,

Coverity complained about $subject.

Close to trivial, will apply both soonish if nobody screams.

Thanks,
Thilo
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/2] lavfi/blockdetect: Fix possible div by 0
  2022-06-04 11:54 [FFmpeg-devel] [PATCH 1/2] lavfi/blockdetect: Fix possible div by 0 Thilo Borgmann
@ 2022-06-04 11:56 ` Andreas Rheinhardt
  2022-06-04 11:59   ` Thilo Borgmann
  2022-06-04 11:57 ` Thilo Borgmann
  1 sibling, 1 reply; 6+ messages in thread
From: Andreas Rheinhardt @ 2022-06-04 11:56 UTC (permalink / raw)
  To: ffmpeg-devel

Thilo Borgmann:
> Hi,
> 
> Coverity complained about $subject.
> 
> Close to trivial, will apply both soonish if nobody screams.
> 

You seem to have forgotten to attach your patches.

- Andreas
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/2] lavfi/blockdetect: Fix possible div by 0
  2022-06-04 11:54 [FFmpeg-devel] [PATCH 1/2] lavfi/blockdetect: Fix possible div by 0 Thilo Borgmann
  2022-06-04 11:56 ` Andreas Rheinhardt
@ 2022-06-04 11:57 ` Thilo Borgmann
  2022-06-04 11:58   ` Thilo Borgmann
  2022-06-06  7:10   ` Thilo Borgmann
  1 sibling, 2 replies; 6+ messages in thread
From: Thilo Borgmann @ 2022-06-04 11:57 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 32 bytes --]

Now with actual patch…

-Thilo

[-- Attachment #2: 0001-lavfi-blockdetect-Fix-possible-div-by-0.patch --]
[-- Type: text/plain, Size: 1273 bytes --]

From 25e875c330e76c2c6be30231e9730fa3a2f30115 Mon Sep 17 00:00:00 2001
From: Thilo Borgmann <thilo.borgmann@mail.de>
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 = (block / block_count) / (nonblock / nonblock_count);
         ret = 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 = (block / block_count) / (nonblock / nonblock_count);
         ret = FFMAX(ret, temp);
+        }
     }
 
     // return highest value of horz||vert
-- 
1.8.3.2


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/2] lavfi/blockdetect: Fix possible div by 0
  2022-06-04 11:57 ` Thilo Borgmann
@ 2022-06-04 11:58   ` Thilo Borgmann
  2022-06-06  7:10   ` Thilo Borgmann
  1 sibling, 0 replies; 6+ messages in thread
From: Thilo Borgmann @ 2022-06-04 11:58 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 16 bytes --]

$subject

-Thilo

[-- Attachment #2: 0002-lavfi-blockdetect-Reindent-after-last-commit.patch --]
[-- Type: text/plain, Size: 1317 bytes --]

From 11bc0a429d35815da7950f85b5f48f90758dc9ef Mon Sep 17 00:00:00 2001
From: Thilo Borgmann <thilo.borgmann@mail.de>
Date: Sat, 4 Jun 2022 13:47:31 +0200
Subject: [PATCH 2/2] lavfi/blockdetect: Reindent after last commit

---
 libavfilter/vf_blockdetect.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_blockdetect.c b/libavfilter/vf_blockdetect.c
index 85fca68..2728359 100644
--- a/libavfilter/vf_blockdetect.c
+++ b/libavfilter/vf_blockdetect.c
@@ -133,8 +133,8 @@ static float calculate_blockiness(BLKContext *s, int w, int h,
             }
         }
         if (block_count && nonblock_count) {
-        temp = (block / block_count) / (nonblock / nonblock_count);
-        ret = FFMAX(ret, temp);
+            temp = (block / block_count) / (nonblock / nonblock_count);
+            ret = FFMAX(ret, temp);
         }
     }
 
@@ -178,8 +178,8 @@ static float calculate_blockiness(BLKContext *s, int w, int h,
             }
         }
         if (block_count && nonblock_count) {
-        temp = (block / block_count) / (nonblock / nonblock_count);
-        ret = FFMAX(ret, temp);
+            temp = (block / block_count) / (nonblock / nonblock_count);
+            ret = FFMAX(ret, temp);
         }
     }
 
-- 
1.8.3.2


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/2] lavfi/blockdetect: Fix possible div by 0
  2022-06-04 11:56 ` Andreas Rheinhardt
@ 2022-06-04 11:59   ` Thilo Borgmann
  0 siblings, 0 replies; 6+ messages in thread
From: Thilo Borgmann @ 2022-06-04 11:59 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



On 4 Jun 2022, at 13:56, Andreas Rheinhardt wrote:

> Thilo Borgmann:
>> Hi,
>>
>> Coverity complained about $subject.
>>
>> Close to trivial, will apply both soonish if nobody screams.
>>
>
> You seem to have forgotten to attach your patches.


Thanks, oh Laptops…. and subjects… and patches… 0:-)

-Thilo
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/2] lavfi/blockdetect: Fix possible div by 0
  2022-06-04 11:57 ` Thilo Borgmann
  2022-06-04 11:58   ` Thilo Borgmann
@ 2022-06-06  7:10   ` Thilo Borgmann
  1 sibling, 0 replies; 6+ messages in thread
From: Thilo Borgmann @ 2022-06-06  7:10 UTC (permalink / raw)
  To: ffmpeg-devel

Am 04.06.22 um 13:57 schrieb Thilo Borgmann:
> Now with actual patch…

Pushed, thanks!

-Thilo
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-06  7:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-04 11:54 [FFmpeg-devel] [PATCH 1/2] lavfi/blockdetect: Fix possible div by 0 Thilo Borgmann
2022-06-04 11:56 ` Andreas Rheinhardt
2022-06-04 11:59   ` Thilo Borgmann
2022-06-04 11:57 ` Thilo Borgmann
2022-06-04 11:58   ` Thilo Borgmann
2022-06-06  7:10   ` Thilo Borgmann

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git