Commit 7ceccdf
authored
Add null checks in tensor parser to prevent SIGSEGV (pytorch#19267)
Summary:
Add two defensive checks in `tensor_parser_exec_aten.cpp`:
1. `getMemPlannedPtr()`: Validate that the `HierarchicalAllocator`
pointer is non-null before dereferencing it. A null allocator causes a
SIGSEGV when a model has memory-planned tensors but the caller provides
zero planned buffers (T266226256 — wearables Android crash at 0.0003%
hit rate).
2. `getTensorDataPtr()`: When a tensor has `allocation_info` (indicating
it expects memory-planned storage), validate that the allocator is
non-null before any code path reaches `getMemPlannedPtr()`. This is the
primary fix; the check in `getMemPlannedPtr` is defense-in-depth.
Differential Revision: D1034677861 parent f1062a7 commit 7ceccdf
1 file changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
44 | 48 | | |
45 | 49 | | |
46 | 50 | | |
| |||
189 | 193 | | |
190 | 194 | | |
191 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
192 | 203 | | |
193 | 204 | | |
194 | 205 | | |
| |||
0 commit comments