diff options
author | Andrew Turner <andrew@FreeBSD.org> | 2012-07-30 10:58:13 +0000 |
---|---|---|
committer | Andrew Turner <andrew@FreeBSD.org> | 2012-07-30 10:58:13 +0000 |
commit | 37dfff057418e02f8e5322da12684dd927e3d881 (patch) | |
tree | 40cc44a3d02ed86de24f2117a55680e4f0eb01a0 /lib/asan/output_tests/heap-overflow.cc | |
parent | 864a7b98b54e1f984c248f3be83dfcc082a382ea (diff) | |
download | src-test2-37dfff057418e02f8e5322da12684dd927e3d881.tar.gz src-test2-37dfff057418e02f8e5322da12684dd927e3d881.zip |
Notes
Diffstat (limited to 'lib/asan/output_tests/heap-overflow.cc')
-rw-r--r-- | lib/asan/output_tests/heap-overflow.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/asan/output_tests/heap-overflow.cc b/lib/asan/output_tests/heap-overflow.cc new file mode 100644 index 000000000000..534fbe00b355 --- /dev/null +++ b/lib/asan/output_tests/heap-overflow.cc @@ -0,0 +1,22 @@ +#include <stdlib.h> +#include <string.h> +int main(int argc, char **argv) { + char *x = (char*)malloc(10 * sizeof(char)); + memset(x, 0, 10); + int res = x[argc * 10]; // BOOOM + free(x); + return res; +} + +// Check-Common: {{READ of size 1 at 0x.* thread T0}} +// Check-Common: {{ #0 0x.* in main .*heap-overflow.cc:6}} +// Check-Common: {{0x.* is located 0 bytes to the right of 10-byte region}} +// Check-Common: {{allocated by thread T0 here:}} + +// Check-Linux: {{ #0 0x.* in .*malloc}} +// Check-Linux: {{ #1 0x.* in main .*heap-overflow.cc:4}} + +// Check-Darwin: {{ #0 0x.* in .*mz_malloc.*}} +// Check-Darwin: {{ #1 0x.* in malloc_zone_malloc.*}} +// Check-Darwin: {{ #2 0x.* in malloc.*}} +// Check-Darwin: {{ #3 0x.* in main heap-overflow.cc:4}} |