mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-18 21:21:17 +00:00
Fix arithmetic overflow warning. (#12712)
Fix arithmetic overflow warning. Suggested fix by static analysis tool Arithmetic overflow: Using operator '+' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '+' to avoid overflow (io.2).
This commit is contained in:
parent
7927d525a7
commit
f1528ea50f
1 changed files with 1 additions and 1 deletions
|
|
@ -57,7 +57,7 @@ struct BinaryElementwisePreparation {
|
|||
[&C](int64_t dim) { if (dim != 1) C = dim; return (dim != 1); })) {
|
||||
int32_t dim_C = gsl::narrow_cast<int32_t>(std::find(rhs_dims.begin(), rhs_dims.end(), C) - rhs_dims.begin() + output_shape.NumDimensions() - rhs_shape.NumDimensions());
|
||||
int64_t N = output_shape.SizeToDimension(dim_C);
|
||||
int64_t H = (dim_C < out_rank - 1 ? output_shape.SizeFromDimension(dim_C + 1) : 1);
|
||||
int64_t H = (dim_C < out_rank - 1 ? output_shape.SizeFromDimension(static_cast<size_t>(dim_C) + 1) : 1);
|
||||
|
||||
std::vector<int64_t> new_output_dims;
|
||||
if (N == 1) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue