static analysis issues
authorAlexander Alekhin <alexander.alekhin@intel.com>
Wed, 19 Jun 2019 16:04:51 +0000 (19:04 +0300)
committerAlexander Alekhin <alexander.alekhin@intel.com>
Thu, 20 Jun 2019 10:55:20 +0000 (13:55 +0300)
modules/calib3d/src/calibration.cpp
modules/dnn/src/layers/batch_norm_layer.cpp
modules/dnn/src/layers/mvn_layer.cpp
modules/dnn/src/layers/reshape_layer.cpp
modules/dnn/src/onnx/onnx_importer.cpp
modules/videoio/src/cap_mfx_writer.cpp

index d24bc90..6640b26 100644 (file)
@@ -2324,6 +2324,8 @@ void cvStereoRectify( const CvMat* _cameraMatrix1, const CvMat* _cameraMatrix2,
     double c = _t[idx], nt = cvNorm(&t, 0, CV_L2);
     _uu[idx] = c > 0 ? 1 : -1;
 
+    CV_Assert(nt > 0.0);
+
     // calculate global Z rotation
     cvCrossProduct(&t,&uu,&ww);
     double nw = cvNorm(&ww, 0, CV_L2);
index a402608..791d8f1 100644 (file)
@@ -33,6 +33,7 @@ public:
 
 
     BatchNormLayerImpl(const LayerParams& params)
+        : dims(-1)
     {
         setParamsFrom(params);
         CV_Assert(blobs.size() >= 2);
index c2d6709..126c86d 100644 (file)
@@ -147,6 +147,7 @@ public:
             UMat &inpMat = inputs[inpIdx];
             UMat &outMat = outputs[inpIdx];
             int newRows = total(shape(inpMat), 0, splitDim);
+            CV_Assert(newRows != 0);
 
             MatShape s = shape(newRows, inpMat.total() / newRows);
             UMat meanMat = UMat(s[0], 1, (use_half) ? CV_16S : CV_32F);
@@ -221,6 +222,7 @@ public:
             UMat &inpMat = inputs[inpIdx];
             UMat &outMat = outputs[inpIdx];
             int newRows = total(shape(inpMat), 0, splitDim);
+            CV_Assert(newRows != 0);
 
             MatShape s = shape(newRows, inpMat.total() / newRows);
             UMat oneMat = UMat::ones(s[1], 1, CV_32F);
index 2b57a73..5cbfc03 100644 (file)
@@ -138,6 +138,7 @@ static void computeShapeByReshapeMask(const MatShape &srcShape,
 
     size_t srcTotal = total(srcShape);
     size_t dstTotal = total(dstShape);
+    CV_Assert(dstTotal != 0);
 
     if (inferDim != -1)
     {
index fb98778..696588c 100644 (file)
@@ -162,6 +162,8 @@ void runLayer(LayerParams& params, const std::vector<Mat>& inputs,
               std::vector<Mat>& outputs)
 {
     Ptr<Layer> layer = LayerFactory::createLayerInstance(params.type, params);
+    CV_Assert((bool)layer);
+
     std::vector<MatShape> inpShapes(inputs.size());
     int ddepth = CV_32F;
     for (size_t i = 0; i < inputs.size(); ++i)
index ed3c30a..8a93fc7 100644 (file)
@@ -30,7 +30,7 @@ inline mfxU32 codecIdByFourCC(int fourcc)
 }
 
 VideoWriter_IntelMFX::VideoWriter_IntelMFX(const String &filename, int _fourcc, double fps, Size frameSize_, bool)
-    : session(0), plugin(0), deviceHandler(0), bs(0), encoder(0), pool(0), frameSize(frameSize_), good(false)
+    : session(0), plugin(0), deviceHandler(0), bs(0), encoder(0), pool(0), outSurface(NULL), frameSize(frameSize_), good(false)
 {
     mfxStatus res = MFX_ERR_NONE;