Hi experts,
I'm using llvm3.4.1 on OSX 10.9.3.
My codes,
// longstack.cc
int* a;
void foo(int n)
{
a[n]++;
foo(++n);
}
int main(int argc, char** argv) {
a = new int[30];
foo(0);
}
And it builds,
/usr/local/Cellar/llvm34/3.4.1_1/bin/clang-3.4 -O0 -g -fsanitize=address
longstack.cc -o ./longstack
Only thing I set is,
export ASAN_SYMBOLIZER_PATH=/usr/local/Cellar/
It reports,
=================================================================
==49571==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x60c00000bff8 at pc 0x10cffbb69 bp 0x7fff52c02a70 sp 0x7fff52c02a68
READ of size 4 at 0x60c00000bff8 thread T0
#0 0x10cffbb68 in foo(int) /Users/tengxiang/Test
Projects/clang/longstack.cc:5
#1 0x10cffbb8d in foo(int) /Users/tengxiang/Test
Projects/clang/longstack.cc:6
...
#30 0x10cffbb8d in foo(int) /Users/tengxiang/Test
Projects/clang/longstack.cc:6
#31 0x10cffbdaa in main /Users/tengxiang/Test
Projects/clang/longstack.cc:11
#32 0x7fff8d8ef5fc in start (/usr/lib/system/libdyld.dylib+0x35fc)
#33 0x0
...
==49571==ABORTING
Please see the callstack foo(int) doesn't tell what's the inbound parameter
int's value.
As comparison, I debugged it with lldb, it shows call stack with "bt".
...
frame #258473: 0x0000000100000f33 longstacknormal`foo(n=32) + 51 at
longstack.cc:6
...
frame #258504: 0x0000000100000f33 longstacknormal`foo(n=1) + 51 at
longstack.cc:6
frame #258505: 0x0000000100000f72 longstacknormal`main(argc=2,
argv=0x00007fff5fbffba0) + 50 at longstack.cc:11
frame #258506: 0x00007fff8d8ef5fd libdyld.dylib`start + 1
Please see foo(n=32).
My question is, did I miss anything or is it possible to get things like
that in ASAN report?
Regards,
-xiang
--
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.