Commit e611bbc
Add overflow checks to getLeadingDims and getTrailingDims
Summary:
Add `c10::mul_overflows()` checks to the dimension-product loops in `getLeadingDims()` and `getTrailingDims()`.
Both functions multiply tensor dimension sizes in a loop with no overflow protection. On 32-bit targets where `size_t` is 32 bits, malicious tensor dimensions from a crafted `.pte` file can cause the product to wrap silently, producing a small value that is then used for buffer offset calculations in 40+ kernels via `coordinateToIndex()`. This enables heap buffer overflows during operator execution.
MACA-2026-001 (T267380210).
Differential Revision: D1034677821 parent a3dd0fa commit e611bbc
1 file changed
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
932 | 933 | | |
933 | 934 | | |
934 | 935 | | |
935 | | - | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
936 | 942 | | |
937 | 943 | | |
938 | 944 | | |
| |||
949 | 955 | | |
950 | 956 | | |
951 | 957 | | |
952 | | - | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
953 | 964 | | |
954 | 965 | | |
955 | 966 | | |
| |||
0 commit comments