Commit 2e4938a
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 2e4938a
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
0 commit comments