1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-21 19:33:03 +04:00

Merge pull request #29418 from uwezkhan:einsum-subscript-bound

bound einsum subscript index before reading input shape
This commit is contained in:
Alexander Smorkalov
2026-07-07 14:42:49 +03:00
committed by GitHub
+3 -2
View File
@@ -953,6 +953,8 @@ void LayerEinsumImpl::processEquation(const std::vector<MatShape>& inputs)
CV_CheckNE(letterIdx, -1,
"The only permissible subscript labels are lowercase letters (a-z) and uppercase letters (A-Z).");
CV_CheckLT(dim_count, rank,
"The Einsum subscripts string has an excessive number of subscript labels compared to the rank of the input.");
int dimValue = shape[dim_count];
// The subscript label was not found in the global subscript label array
@@ -980,8 +982,7 @@ void LayerEinsumImpl::processEquation(const std::vector<MatShape>& inputs)
++letter2count[letterIdx];
currTokenIndices.push_back(letter2index[letterIdx]);
CV_CheckLE(++dim_count, rank,
"The Einsum subscripts string has an excessive number of subscript labels compared to the rank of the input.");
++dim_count;
}
}