[FFmpeg-cvslog] lavfi/blockdetect: Fix possible div by 0
Thilo Borgmann
git at videolan.org
Mon Jun 6 10:10:10 EEST 2022
ffmpeg | branch: master | Thilo Borgmann <thilo.borgmann at mail.de> | Sat Jun 4 13:45:30 2022 +0200| [b7cea557304b8733074f512629043f37130c5181] | committer: Thilo Borgmann
lavfi/blockdetect: Fix possible div by 0
Found-by Covererity, CID 1504568, 1504569
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b7cea557304b8733074f512629043f37130c5181
---
libavfilter/vf_blockdetect.c | 4 ++++
1 file changed, 4 insertions(+)
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
More information about the ffmpeg-cvslog
mailing list