Mail Archives: djgpp/2000/04/19/03:56:12
On Tue, 18 Apr 2000, J.P. Morris wrote:
> > I suggest using the _CRT0_FLAG_FILL_SBRK_MEMORY (not
> > _CRT0_FLAG_FILL_DEADBEEF!) to see whether this is your problem.
>
> At one stage I tried this, but it crashed by NULL dereference
> instead.
This, in my opinion, is a clear indication that your program either
uses uninitialized pointers, or somehow overwrites pointers with data
from uninitialized buffers.
> Suppose I did this?
>
> char array[128];
>
> for(ctr=0;ctr<65535;ctr++)
> array[ctr]=0;
>
> Fortify (and presumably MSS et al) put sentry-blocks around memory that
> is allocated dynamically, using a wrapper around malloc() and calloc(),
> but since malloc and free aren't used for local arrays or other objects,
> it wouldn't detect that unless it was a big enough overrun to reach
> a dynamically-allocated object.
That's why I suggested to use watchpoints inside a debugger. You can
put a watchpoint on one or more (up to 4) pointers that get corrupted,
and then the debugger will catch the code which does that, when it
does so.
- Raw text -