Page 1 of 1

Debug error: heap corruption detected

Posted: Sat Mar 28, 2009 11:03 am
by Janschenkel
Still working on the same external - no more Run-Time check failures, but now I'm encountering my second problem.

I call into the other library, which returns a string with the correct data (inside the debugger anyway), which I copy into a new char buffer to hand back to Revolution. As soon as I come out of my function, I get the following message from the Microsoft Visual C++ Debug Library:
Debug error!

Program: C:\Program Files\Revoluton Enterprise\3.0.0-gm-3\Revolution.exe

HEAP CORRUPTION DETECTED: after Nortmal block (#84) at 0x02086EE8.
CRT detected that the application wrote to memory after end of heap buffer.

(Press Retry to debug the application)

(Abort) (Retry) (Ignore)
Pressing Retry doesn't help of course, as I can't debug Revolution :-)
Pressing Ignore lets me continue, but the result of the external function call is empty.

Any ideas?

Jan Schenkel.

Posted: Tue Mar 31, 2009 7:20 pm
by Janschenkel
For others facing this problem, it turned out to be a problem with my return values: I made an error in the return value size calculation, thereby returning a string that had one byte too many allocated to it.
At least I was consistent in my error, so once realization sank in, it was a quick fix accross the source code.

Slowly moving forwards, but glad to see actual values coming through :-)

Jan Schenkel.

Posted: Wed Apr 01, 2009 6:39 am
by mwieder
I was just gonna suggest that maybe you're copying a string into a buffer that's too small... Great! Now on to the next bug...