From 4e78f638475a4dcdcdd88c6c62c9e3e4d1e77bfe Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Thu, 20 Feb 2020 10:09:21 +0000 Subject: [PATCH] [libvpx] scan-build: Division by zero - measure_square_diff_partial() --- libs/libvpx/vp8/encoder/onyx_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libvpx/vp8/encoder/onyx_if.c b/libs/libvpx/vp8/encoder/onyx_if.c index 4fd1574924..c091594121 100644 --- a/libs/libvpx/vp8/encoder/onyx_if.c +++ b/libs/libvpx/vp8/encoder/onyx_if.c @@ -3017,7 +3017,7 @@ static int measure_square_diff_partial(YV12_BUFFER_CONFIG *source, // Only return non-zero if we have at least ~1/16 samples for estimate. if (num_blocks > (tot_num_blocks >> 4)) { assert(num_blocks != 0); - return (Total / num_blocks); + return num_blocks ? (Total / num_blocks) : 0; } else { return 0; }