Skip to content

Commit

Permalink
Use int64_t instead of int for in loop that may overflow. (pytorch#8435)
Browse files Browse the repository at this point in the history
  • Loading branch information
colesbury authored Jun 13, 2018
1 parent 2c9c48a commit 4d287f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aten/src/ATen/native/cpu/ReduceOpsKernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ struct Reduction {
sum = std::accumulate(buf, buf + WIDTH, scalar_t(ident), ReduceScalar());
}

for (int i = k * WIDTH; i != size; i++) {
for (int64_t i = k * WIDTH; i != size; i++) {
sum = ReduceScalar()(sum, data[i]);
}
return sum;
Expand Down

0 comments on commit 4d287f9

Please sign in to comment.