Repository navigation
Commit 73a9d6e
Qualcomm overflow fixes (pytorch#19469)
Replace std::accumulate with std::multiplies<>() with an explicit loop
using c10::mul_overflows() to detect overflow before each
multiplication. The previous code accumulated into a uint32_t, which
would silently wrap on overflow and cause CreateTensorWrapper to
allocate or report an undersized buffer for the tensor data.
CreateTensorWrapper has no error return, so abort via ET_CHECK_MSG when
overflow is detected. This is AOT-only host code.
This PR was authored with the assistance of Claude.
Co-authored-by: Github Executorch <github_executorch@arm.com>1 parent ce08814 commit 73a9d6e
1 file changed
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
181 | 184 | | |
182 | 185 | | |
183 | 186 | | |
184 | | - | |
185 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
186 | 195 | | |
187 | 196 | | |
188 | 197 | | |
| |||
0 commit comments