diff options
| author | Kostya Serebryany <kcc@google.com> | 2012-04-23 10:08:16 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2012-04-23 10:08:16 +0000 |
| commit | c5bf3ad92229d23c9bdeae9e57101042e19b01ec (patch) | |
| tree | c9411895c67a932d53934e00752a49c00f13c1aa | |
| parent | f43ce266887983b639cce77eff0f712d4eec5fdd (diff) | |
| download | bcm5719-llvm-c5bf3ad92229d23c9bdeae9e57101042e19b01ec.tar.gz bcm5719-llvm-c5bf3ad92229d23c9bdeae9e57101042e19b01ec.zip | |
[asan] fix asan issue #66 (correctly report type of the bug)
llvm-svn: 155344
| -rw-r--r-- | compiler-rt/lib/asan/asan_allocator.cc | 1 | ||||
| -rw-r--r-- | compiler-rt/lib/asan/tests/asan_test.cc | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/compiler-rt/lib/asan/asan_allocator.cc b/compiler-rt/lib/asan/asan_allocator.cc index 8c3cc00cf46..59d66263a84 100644 --- a/compiler-rt/lib/asan/asan_allocator.cc +++ b/compiler-rt/lib/asan/asan_allocator.cc @@ -498,6 +498,7 @@ class MallocInfo { CHECK(m->chunk_state == CHUNK_QUARANTINE); m->chunk_state = CHUNK_AVAILABLE; + PoisonShadow((uintptr_t)m, m->Size(), kAsanHeapLeftRedzoneMagic); CHECK(m->alloc_tid >= 0); CHECK(m->free_tid >= 0); diff --git a/compiler-rt/lib/asan/tests/asan_test.cc b/compiler-rt/lib/asan/tests/asan_test.cc index 5c38952536e..3f251dd6fdf 100644 --- a/compiler-rt/lib/asan/tests/asan_test.cc +++ b/compiler-rt/lib/asan/tests/asan_test.cc @@ -1835,12 +1835,12 @@ TEST(AddressSanitizer, DISABLED_DemoTooMuchMemoryTest) { } // http://code.google.com/p/address-sanitizer/issues/detail?id=66 -TEST(AddressSanitizer, DISABLED_BufferOverflowAfterManyFrees) { +TEST(AddressSanitizer, BufferOverflowAfterManyFrees) { for (int i = 0; i < 1000000; i++) { delete [] (Ident(new char [8644])); } char *x = new char[8192]; - x[Ident(8192)] = 0; + EXPECT_DEATH(x[Ident(8192)] = 0, "AddressSanitizer heap-buffer-overflow"); delete [] Ident(x); } |

