It's just that ASan detects errors on a best effort basis, and it's
harder to detect a buffer overflow past the buffer's redzone.
On the other hand, such errors are quite rare.

On Tue, May 2, 2017 at 3:34 PM, Aayushi Agrawal <aayushigr...@gmail.com> wrote:
> So is this a kind of issue which is not handled by address sanitizer ?
>
> On 02-May-2017 5:45 pm, "'Alexander Potapenko' via address-sanitizer"
> <address-sanitizer@googlegroups.com> wrote:
>>
>> Most certainly the access to global_array[200] ends up touching a
>> valid location in g[], and the access to g[200] lands somewhere in a
>> region that has a shadow value of 0.
>> Unfortunately ASan can only detect a buffer overflow if the memory
>> access touches unaddressable memory (i.e. that with non-zero shadow).
>>
>> On Tue, May 2, 2017 at 2:09 PM, Aayushi Agrawal <aayushigr...@gmail.com>
>> wrote:
>> > Hello
>> >
>> > Here is code snippet  -
>> >
>> > int global_array[101] = {-1};
>> > char g[101] = {-2};
>> >
>> > int main(int argc, char **argv) {
>> >   global_array[atoi(argv[1])] = 70;
>> >   g[atoi(argv[1])] = 'c';
>> >
>> > }
>> >
>> > If I compile it with clang , address sanitizer and no other flags used
>> > then
>> > for input as "101" it gives ASAN buffer overflow message but input as
>> > "200"
>> > does not show any buffer overflow why ?
>> >
>> >
>> > Aayushi
>> >
>> > --
>> > 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 address-sanitizer+unsubscr...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Alexander Potapenko
>> Software Engineer
>>
>> Google Germany GmbH
>> Erika-Mann-Straße, 33
>> 80636 München
>>
>> Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
>> Registergericht und -nummer: Hamburg, HRB 86891
>> Sitz der Gesellschaft: Hamburg
>>
>> --
>> 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 address-sanitizer+unsubscr...@googlegroups.com.
>> 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 address-sanitizer+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

-- 
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 address-sanitizer+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to