Add null checks in tensor parser to prevent SIGSEGV#19267
Add null checks in tensor parser to prevent SIGSEGV#19267rascani wants to merge 1 commit intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19267
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New Failures, 4 Unrelated FailuresAs of commit f0fa552 with merge base a3dd0fa ( NEW FAILURES - The following jobs have failed:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@rascani has exported this pull request. If you are a Meta employee, you can view the originating Diff in D103467786. |
This PR needs a
|
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: D103467786
Summary:
Add two defensive checks in
tensor_parser_exec_aten.cpp:getMemPlannedPtr(): Validate that theHierarchicalAllocatorpointer 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).getTensorDataPtr(): When a tensor hasallocation_info(indicating it expects memory-planned storage), validate that the allocator is non-null before any code path reachesgetMemPlannedPtr(). This is the primary fix; the check ingetMemPlannedPtris defense-in-depth.Differential Revision: D103467786