I'm debugging a software which crashes eventually with one of the following messages:
1. DAMAGE: after normal block (#24729280) at 0x00D710E0
2. Debug Assertion Failed
Program: D:\Soft\Test.exe
File: dbgheap.c
Line: 1017
Expression: _BLOCK_TYPE_IS_VALID(phead->nBlockUse)
This software is really old but changing it now is not an option. It's written on Visual C++ 6.0. We are guessing it's some kind of buffer overflow, so we are trying to find ways to detect where it is happening.
I have found information about PageHeap (which seems to be able to tell me what I want) and GFlags, but it seems I can't make it work.
I created a test program:
char* test;
test = new char[5];
test[5] = 'a';
delete[] test;
which raises an error:
DAMAGE: after normal block (#55) at 0x1671920
Then, I tried attaching PageHeap to it by running:
gflags.exe /p /enable MemoryTest.exe /full
and then rerunning it (both through Visual C++ 6.0 interface and through the windows explorer), which resulted on the same error.
Then I tried to compile the release version, and ran it through the Visual C++ 6.0 interface to get the error:
User breakpoint called from code at 0x7c90120e
And from the windows explorer, I just got the windows dialog asking me to send an error report.
What am I missing?
You can run your application in release mode by attaching to Windbg.
gflags( As you mentioned)Attach to processoption in Windbg..reload /fin case of automatic loading fails.WinDbg would stop the execution whenever an exception occurs. For every first chance exception, analyze the reasons. It could be one of the error for crash.