facebookexperimental / object-introspection

Object Introspection (OI) enables on-demand, hierarchical profiling of objects in arbitrary C/C++ programs with no recompilation.
Apache License 2.0
163 stars 14 forks source link

tbv2: fix Thrift isset lookups with padding #464

Closed JakeHillion closed 9 months ago

JakeHillion commented 9 months ago

tbv2: fix Thrift isset lookups with padding

Thrift isset was failing with a SEGV if the struct contained padding. This is because we indexed the isset_indexes data structure using our field index rather than the index of the field in Thrift. This then gave a rubbish index for any exceeding which happens if we have added padding in the middle of the struct, and this index was looked up in the bitset which can cause a SEGV.

Track a new index thriftFieldIdx which is only incremented if we've looked up a Thrift index.

Namespaced the generated Thrift structs while I was there. This isn't necessary anymore but cleans things up.

Test plan: