Mail Archives: djgpp/2000/04/18/12:53:59
J.P. Morris <doug-15 AT bigfoot DOT com> wrote:
> Eli Zaretskii 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.
You should have tried that in a debugger, and checked where this NULL
pointer came from, to find the bug.
[...]
> 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.
Right. To detect overruns or underruns in arrays not coming from
malloc() (i.e. automatic ones on the stack, or static ones), you need
other tools. You might want to try the GCC extension 'Checker-gcc',
for this. Unlike the usual malloc()-checkers, it can also check
non-malloc()ed storage. It will only work with Linux, not DJGPP,
though.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -