Hi All,

I am very new to Address Sanitizer. I implemented Address sanitizer on 
sample c/c++ files named "free.c" and got error reports in command 
terminal. Command I used for the same , I am mentioning below:

*clang -fsanitize=address -O1 -fno-omit-frame-pointer -g 
tests/use-after-free.c*

output: Ex-1
% ./a.out
==9901==ERROR: AddressSanitizer: heap-use-after-free on address 
0x60700000dfb5 at pc 0x45917b bp 0x7fff4490c700 sp 0x7fff4490c6f8
READ of size 1 at 0x60700000dfb5 thread T0
    #0 0x45917a in main use-after-free.c:5
    #1 0x7fce9f25e76c in __libc_start_main 
/build/buildd/eglibc-2.15/csu/libc-start.c:226
    #2 0x459074 in _start (a.out+0x459074)
0x60700000dfb5 is located 5 bytes inside of 80-byte region 
[0x60700000dfb0,0x60700000e000)
freed by thread T0 here:
    #0 0x4441ee in __interceptor_free 
projects/compiler-rt/lib/asan/asan_malloc_linux.cc:64
    #1 0x45914a in main use-after-free.c:4
    #2 0x7fce9f25e76c in __libc_start_main 
/build/buildd/eglibc-2.15/csu/libc-start.c:226
previously allocated by thread T0 here:
    #0 0x44436e in __interceptor_malloc 
projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74
    #1 0x45913f in main use-after-free.c:3
    #2 0x7fce9f25e76c in __libc_start_main 
/build/buildd/eglibc-2.15/csu/libc-start.c:226
SUMMARY: AddressSanitizer: heap-use-after-free use-after-free.c:5 main

Likewise , I want to implement Address Sanitizer on AOSP c/c++ files while 
building the source code. I want similar kind of error reporting in 
building AOSP with Address Sanitizer.
I tried adding some *CFLAGS and LOCAL_SANITIZE tags in Android.mk* files 
and kept the same sample "free.c" files in an apps folder. It is getting 
build successfully but it should give same error report as it is throwing in 
Ex-1 above.

If anyone knows, please help me on this. Thanks in advance.

Thanks and regards,
Anupam Anurag

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/address-sanitizer/262bb2b9-2185-4db3-9a44-0e9f395de17cn%40googlegroups.com.

Reply via email to