|
From: Tom H. <th...@cy...> - 2004-03-24 08:53:48
|
In message <429...@ft...>
RAMPARANY Fano <fan...@fr...> wrote:
> Does valgrind detect illegal access to statically allocated memory?
>
> e.g. valgrind doesn't report any error on the following code:
>
> ...
> int mytable[5];
> ...
> mytable[6] = mytable[7];
> ...
That isn't statically allocated, it's allocated on the stack.
In general valgrind will not be able to detect stack overruns like
this. Although it will warn about the use of uninitialised values from
the stack, any value above the current stack point is considered
accessible and therefore writable.
It is in fact virtually impossible to spot the kind of error you show
with a purely run time instrumenter, as you would normally need to add
padding between the variables at compile time to detect the overruns.
Tom
--
Tom Hughes (th...@cy...)
Software Engineer, Cyberscience Corporation
http://www.cyberscience.com/
|