On 11/19/21 10:04 AM, frame wrote: > On Friday, 19 November 2021 at 15:46:41 UTC, Adam D Ruppe wrote: > >> The `destroy` function (as well as other class destruction) will null >> out the whole vtable to help make use-after-free an obvious error. >> Possible that happened to you. > > So, a partial nulled table shouldn't exist, right? like this: > > __vptr[0]: address > __vptr[1]: 0000000 > __vptr[2]: address > __vptr[3]: address > __vptr[4]: address > __vptr[5]: address > .... > > Because 0 should point to the object instance
I am not sure that's correct. The way I picture it, the code reaches the __vptr by following a pointer; so it's already known. Additionally, I am under the impression that there is only one __vptr for a given type, which all class objects of that type point to.
> and next offsets are pointers to the member functions, correct? My understanding is that all entries are that. Ali