From d4d95bd70d72fbf7c96d223eff837818a2f30673 Mon Sep 17 00:00:00 2001 From: Maksim Shabunin Date: Mon, 16 Mar 2020 15:49:51 +0300 Subject: [PATCH] Fixs several problems found by static analysis --- modules/features2d/src/kaze/AKAZEFeatures.cpp | 1 + modules/objdetect/src/qrcode.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/modules/features2d/src/kaze/AKAZEFeatures.cpp b/modules/features2d/src/kaze/AKAZEFeatures.cpp index 9b0d8311b0..89cf66bc24 100644 --- a/modules/features2d/src/kaze/AKAZEFeatures.cpp +++ b/modules/features2d/src/kaze/AKAZEFeatures.cpp @@ -1323,6 +1323,7 @@ void quantized_counting_sort(const float a[], const int n, const float quantum, const int nkeys, int idx[/*n*/], int cum[/*nkeys + 1*/]) { + CV_Assert(nkeys > 0); memset(cum, 0, sizeof(cum[0]) * (nkeys + 1)); // Count up the quantized values diff --git a/modules/objdetect/src/qrcode.cpp b/modules/objdetect/src/qrcode.cpp index f99a46c922..4990dfd388 100644 --- a/modules/objdetect/src/qrcode.cpp +++ b/modules/objdetect/src/qrcode.cpp @@ -1608,6 +1608,8 @@ bool QRDetectMulti::checkPoints(const vector& quadrangle_points) li2++; } } + if (count_w == 0) + return false; double frac = double(count_b) / double(count_w); double bottom_bound = 0.76;