Commit 3d9d308
Github Executorch
Fix double-scaled pointer arithmetic in ETDumpGen constructor (TOB-EXECUTORCH-32)
The expression `builder_ + sizeof(struct flatcc_builder)` double-scales
the offset because `builder_` is a `struct flatcc_builder*` -- the
compiler already multiplies by `sizeof(struct flatcc_builder)` for typed
pointer arithmetic. The result advances far past the intended 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.1 parent 21d9c64 commit 3d9d308
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