Hi Hanno!

First, is that clang or gcc, and which version?
Second, is that C or C++?
If this is C, try adding -fno-common (in C, some of the globals are not
instrumented with asan unless you use -fno-common).
Finally, artificial tests like this are often misleading because the
compiler statically sees the bug and should warn about it,
but also can optimize the code away before asan has a chance to instrument
the code.
Try to prepare a test where the bug is not easy to discover statically.

On Sun, Jul 26, 2015 at 12:20 PM, Hanno Böck <[email protected]> wrote:

> Hi,
>
> I noted some unexpected behaviour by asan. See this simple example:
> int a[1]={0};
> int main() {
>         int b=a[1];
> }
>
> A trivial out of bounds array access to a.
> As expected compiling and running with asan will report a
> global-buffer-overflow. However if you change it to this:
> int a[1];
> int main() {
>         int b=a[1];
> }
> asan will let it pass without an error.
>
>
> The only difference is if the global array a is pre-initialized with a
> value or not.
>
> Is this somehow expected or a known limitation of asan or is this a bug?
>
> cu,
> --
> Hanno Böck
> http://hboeck.de/
>
> mail/jabber: [email protected]
> GPG: BBB51E42
>
> --
> You received this message because you are subscribed to the Google Groups
> "address-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to