Web Log of Aleksey Nudelman: Thoughts on Software Architecture

Analysis and Review of Microsoft Technologies for IT Managers, Architects and Developers

Tuesday, October 11th

Finding Heap Corruption


I was working remote debugging a C++ app and came across this error:
HEAP[IBDialog.exe]: Heap entry 801690 has incorrect PreviousSize field (6576 instead of 00cc)
Unhandled exception at 0x77f9193c in IBDialog.exe: User breakpoint.

To find memory corruption, I simply set
_CrtSetDbgFlag ( CRTDBG_CHECK_ALWAYS_DF);

in the beginning of the main method.

This is all very dandy. Let's step into the code...
The first corruption occurs on this line : char *t=new char [8]; Is there anything wrong? Has char type been compromised? No. VS.NET 2003 incorrectly reports heap corruption when it is running through remote debugging. (debuggee addresses do not match debugger addresses).

aleksey on 10.11.05 @ 10:37 PM PST [link]



  Home
  Archives
Phishing Inspector is  available

Copyright© 2006 Aleksey Nudelman