开发者

vptr and buffer overflow issue

I have an object of an inherited class type (say it's type B and it inherits from A), and I suspect it's vptr gets corrupted due to buffer overflow somewhere in the system. I think this is the case because in runtime when trying to access a public method of that object I SOMETIMES get "Access violation."

A. Any开发者_JS百科 ideas? B. I get a pointer to object A as a parameter to the method where I try to access it. If indeed the vptr is corrupted can I verify this by trying to perform dynamic_cast on the A pointer to use it as B and hope it fails in case there's a problem with the vptr?

Thank you


Ad A: Try using duma or electric-fence library for debugging buffer overruns.

Ad B: Yes, if the vptr is corrupted, dynamic_cast will fail on it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜