diff options
author | Thilo Borgmann <thilo.borgmann@mail.de> | 2022-06-04 13:45:30 +0200 |
---|---|---|
committer | Thilo Borgmann <thilo.borgmann@mail.de> | 2022-06-06 09:09:25 +0200 |
commit | b7cea557304b8733074f512629043f37130c5181 (patch) | |
tree | 382f30b9bf6344dc4fb29a881ce73b4af1630d40 /libavfilter | |
parent | 11912f65ef5ad12db938e404eafc855af1bc3859 (diff) | |
download | ffmpeg-b7cea557304b8733074f512629043f37130c5181.tar.gz |
lavfi/blockdetect: Fix possible div by 0
Found-by Covererity, CID 1504568, 1504569
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vf_blockdetect.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavfilter/vf_blockdetect.c b/libavfilter/vf_blockdetect.c index 8503b8d815..85fca68945 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 |