You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1.[root@localhost samples]# cat test.c
int *ptr = (void *) 0;
void func()
{
int a = 10;
ptr = &a;
}
int main()
{
func();
return *ptr //Dangling pointer reference.
}
2. clang -g -faddress-sanitizer -fno-omit-frame-pointer -o test test.c
3../test
What is the expected output? What do you see instead?
Expected :
We See :
What version of the product are you using? On what operating system?
[root@localhost opensrc]# clang --version
clang version 3.2 (trunk)
Target: i386-pc-linux-gnu
Thread model: posix
[root@localhost opensrc]# uname -a
Linux localhost.localdomain 2.6.32-220.el6.i686 #1 SMP Tue Dec 6 16:15:40 GMT 2011
i686 i686 i386 GNU/Linux
[root@localhost opensrc]# cat /etc/centos-release
CentOS release 6.2 (Final)
Reported by umesh.kalappa0 on 2012-05-15 06:56:44
The text was updated successfully, but these errors were encountered:
By default, asan does not detect use-after-return.
As mentioned at http://code.google.com/p/address-sanitizer/wiki/ExampleUseAfterReturn,
you need to use an additional build flag: -mllvm -asan-use-after-return.
With this flag I get a warning:
==20526== ERROR: AddressSanitizer stack-use-after-return on address 0x7fe82beb3220
at pc 0x406a84 bp 0x7fffbf9f0550 sp 0x7fffbf9f0548
READ of size 4 at 0x7fe82beb3220 thread T0
#0 0x406a84 (test+0x406a84)
#1 0x7fe82c6d1c4d (/lib/libc-2.11.1.so+0x1ec4d)
Address 0x7fe82beb3220 is located at offset 32 in frame <func> of T0's stack:
This frame has 1 object(s):
[32, 36) 'a'
Note, that this mode is still experimental and not officially supported.
Reported by konstantin.s.serebryany on 2012-05-15 07:02:43
Originally reported on Google Code with ID 71
Reported by
umesh.kalappa0
on 2012-05-15 06:56:44The text was updated successfully, but these errors were encountered: