I am trying to suppress a warning from the address sanitizer in clang/gcc
My source file looks like this:
int foo(){
double bar[] = {7,8};
return bar[3];
}
int main(){
return foo();
}
and obviously there is an overflow at line 3.
the suppression file (myasan.supp) contains:
interceptor_via_fun:foo
compiling (clang also creates a warning) and running:
clang -O0 -g -fsanitize=address -fno-omit-frame-pointer sanitizerTest.c
ASAN_SYMBOLIZER_PATH=/software/clang/7.0.0/bin/llvm-symbolizer ASAN_OPTIONS=suppressions=myasan.supp ./a.out
but the address sanitizer still complains about the overflow.
==8119==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffeab4e75f8 at pc 0x0000004008bf bp 0x7ffeab4e75b0 sp 0x7ffeab4e75a8
READ of size 8 at 0x7ffeab4e75f8 thread T0
#0 0x4008be in foo() /tmp/asan/sanitizerTest.c:3
#1 0x400919 in main /tmp/asan/sanitizerTest.c:7
#2 0x7f549fbfb82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#3 0x400718 in _start (/tmp/asan/a.out+0x400718)
Compiler is clang7. I tested clang6, gcc7 as well.
Any idea how to make this work?
clang
/gcc
, or do you useclang++
/g++
? – Foam