Fixs several problems found by static analysis
authorMaksim Shabunin <maksim.shabunin@gmail.com>
Mon, 16 Mar 2020 12:49:51 +0000 (15:49 +0300)
committerMaksim Shabunin <maksim.shabunin@gmail.com>
Mon, 16 Mar 2020 16:15:26 +0000 (19:15 +0300)
modules/features2d/src/kaze/AKAZEFeatures.cpp
modules/objdetect/src/qrcode.cpp

index 9b0d831..89cf66b 100644 (file)
@@ -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
index f99a46c..4990dfd 100644 (file)
@@ -1608,6 +1608,8 @@ bool QRDetectMulti::checkPoints(const vector<Point2f>& quadrangle_points)
             li2++;
         }
     }
+    if (count_w == 0)
+        return false;
 
     double frac = double(count_b) / double(count_w);
     double bottom_bound = 0.76;