Commit 1fc3ee6
Github Executorch
Use safe_numel() in wasm bindings
The wasm bindings' assert_valid_numel() helper previously computed numel without overflow detection, letting a malicious tensor shape wrap to a small value that bypassed the data-size check. Replace with safe_numel() (returns Result<ssize_t>) and propagate the error via THROW_IF_ERROR as a JavaScript exception, matching the rest of the wasm error plumbing.
Authored with Claude.
Differential Revision: [D102082911](https://our.internmc.facebook.com/intern/diff/D102082911/)
[ghstack-poisoned]1 parent 25e8f81 commit 1fc3ee6
1 file changed
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
97 | 100 | | |
98 | | - | |
| 101 | + | |
99 | 102 | | |
100 | | - | |
| 103 | + | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
| |||
0 commit comments