[Previous entry: "Book Review: "MS Windows Internals" by Mark Russinovich and David Solomon"] [Next entry: "Norton Ghost 9.0 is amazing."]
10/11/2005: "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).