Commit 52b7f06
Github Executorch
Add type validation in BoxedEvalueList::get() for TOCTOU defense
MoveCall instructions can overwrite values_ entries after parseTensorList
validated their types, creating a time-of-check-time-of-use window.
The existing to<T>() calls have ET_CHECK_MSG type guards that abort on
mismatch, but the error messages don't indicate the TOCTOU cause.
Add explicit type validation with clear diagnostic messages in:
- BoxedEvalueList<optional<Tensor>>::get() (evalue.cpp)
- Improved null check messages in the generic template (evalue.h)
The to<T>() type checks in EValue provide defense in depth for the
generic template (including BoxedEvalueList<Tensor> and <int64_t>).
Note: fully preventing the abort (DoS) would require changing
BoxedEvalueList<T>::get() to return Result<ArrayRef<T>>, which is a
larger API change tracked separately.
Addresses TOB-EXECUTORCH-31.
This PR was authored with the assistance of Claude.1 parent 75fe8e9 commit 52b7f06
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