Commit c09c713
Fix double-scaled pointer arithmetic in ETDumpGen constructor (pytorch#18782)
`builder_ + sizeof(struct flatcc_builder)` results in `builder_ +
sizeof(struct flatcc_builder) * sizeof(struct flatcc_builder)`
Because C/C++ arithmetic builder_ + N advances by N*sizeof(type) where
type is the type of builder_. This means we get a pointer that advances
past the intended memory location, potentially into unallocated memory.
Replace with `builder_ + 1`, which correctly advances by exactly one
`sizeof(struct flatcc_builder)` element.
This PR was authored with the assistance of Claude.
Co-authored-by: Github Executorch <github_executorch@arm.com>1 parent 875f7c8 commit c09c713
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
| 119 | + | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
0 commit comments