Commit c0cef6c
Title: Fix OOB heap read in bundled program tensor deserialization (pytorch#17163)
Summary:
This diff addresses a security vulnerability (TOB-EXECUTORCH-9) in the
bundled program tensor parsing code.
Problem:
tensor_like() in bundled_program.cpp copies tensor data using
ret_tensor.nbytes() derived from the sizes[] field No validation that
data[] buffer actually contains that many bytes A malicious .bpte file
could claim large dimensions with minimal data, causing heap over-read
Fix:
Added null check for bundled_tensor->data()
Added size validation: data()->size() >= ret_tensor.nbytes() Memcpy only
proceeds if source buffer is sufficiently sized
Co-authored-by: Github Executorch <github_executorch@arm.com>1 parent eee5d96 commit c0cef6c
1 file changed
+9
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
57 | 66 | | |
58 | 67 | | |
59 | 68 | | |
| |||
0 commit comments