Skip to content

Commit 792b7e0

Browse files
mshabuninalalek
authored andcommitted
(3.4) Fixed several issues found by static analysis
original commit: a079c2e
1 parent 6a889ed commit 792b7e0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

modules/dnn/src/onnx/onnx_importer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,9 @@ void ONNXImporter::parseUnsqueeze(LayerParams& layerParams, const opencv_onnx::N
18211821
}
18221822
CV_Assert(axes.getIntValue(axes.size()-1) <= dims.size());
18231823
for (int j = 0; j < axes.size(); j++) {
1824-
dims.insert(dims.begin() + axes.getIntValue(j), 1);
1824+
const int idx = axes.getIntValue(j);
1825+
CV_Assert(idx <= dims.size());
1826+
dims.insert(dims.begin() + idx, 1);
18251827
}
18261828

18271829
Mat out = input.reshape(0, dims);

modules/objdetect/src/qrcode_encoder.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,8 @@ void QRCodeEncoderImpl::findAutoMaskType()
881881
total_modules += 1;
882882
}
883883
}
884+
if (total_modules == 0)
885+
continue; // TODO: refactor, extract functions to reduce complexity
884886
int modules_percent = dark_modules * 100 / total_modules;
885887
int lower_bound = 45;
886888
int upper_bound = 55;

0 commit comments

Comments
 (0)