(3.4) Fixed several issues found by static analysis

original commit: a079c2eb7c
pull/21277/head
Maksim Shabunin 3 years ago committed by Alexander Alekhin
parent 6a889ed3e5
commit 792b7e0629
  1. 4
      modules/dnn/src/onnx/onnx_importer.cpp
  2. 2
      modules/objdetect/src/qrcode_encoder.cpp

@ -1821,7 +1821,9 @@ void ONNXImporter::parseUnsqueeze(LayerParams& layerParams, const opencv_onnx::N
}
CV_Assert(axes.getIntValue(axes.size()-1) <= dims.size());
for (int j = 0; j < axes.size(); j++) {
dims.insert(dims.begin() + axes.getIntValue(j), 1);
const int idx = axes.getIntValue(j);
CV_Assert(idx <= dims.size());
dims.insert(dims.begin() + idx, 1);
}
Mat out = input.reshape(0, dims);

@ -881,6 +881,8 @@ void QRCodeEncoderImpl::findAutoMaskType()
total_modules += 1;
}
}
if (total_modules == 0)
continue; // TODO: refactor, extract functions to reduce complexity
int modules_percent = dark_modules * 100 / total_modules;
int lower_bound = 45;
int upper_bound = 55;

Loading…
Cancel
Save