4 Aug
2013
4 Aug
'13
12:17 a.m.
On Aug 3, 2013, at 2:50 PM, Johan Engelen wrote:
The reason I found it is that cppcheck complained about the virtual method thing. I always thought in case of virtual methods, the pointer "style" points to the VTable (or Vtable pointer) first, and the actual struct members start after that. So in that case, memset will overwrite the vtable entry, right?
Yes. Or rather, the first member of the instance is a pointer to its vtable. So adding more virtual functions to a given class will not keep expanding the size. So then if you memset that instances address to 0, the virtual functions will start going BOOM!!!