Skip to content

Commit f071207

Browse files
committed
Merge pull request opencv#21277 from alalek:backport_21267
2 parents cee3ec6 + 792b7e0 commit f071207

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

modules/dnn/src/onnx/onnx_importer.cpp

+3-1
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

+2
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)