Commit deaf73b
Destroy unwrapped_vals instead of wrapped_vals (pytorch#18962)
Destroy unwrapped_vals instead of dereferencing wrapped_vals.
When a kernel uses TensorLists, it calls EValue::toTensorList(). This
dereferences wrapped_vals into unwrapped_vals to get the tensor list.
During execution, a (crafted) MoveCall potentially moves an Int into the
TensorList. This means wrapped_vals now points to an Int, whereas
unwrapped_vals still holds a Tensor.
Instead of calling destructor on the wrapped_vals (ref to tensor), call
the destructor on the unwrapped_vals which contain the real tensor.
Vulnerability: During method destruction, the BoxedEvalueList
dereferences its stored pointer and attempts to convert the swapped
value to a Tensor, causing a type confusion that terminates the process.
This results in a denial of service.
Addresses TOB-EXECUTORCH-31.
This PR was authored with the assistance of Claude.
Co-authored-by: Github Executorch <github_executorch@arm.com>1 parent 2739129 commit deaf73b
1 file changed
Lines changed: 16 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
74 | 88 | | |
75 | 89 | | |
76 | 90 | | |
| |||
491 | 505 | | |
492 | 506 | | |
493 | 507 | | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
| 508 | + | |
498 | 509 | | |
499 | 510 | | |
500 | 511 | | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
| 512 | + | |
506 | 513 | | |
507 | 514 | | |
508 | 515 | | |
| |||
0 commit comments