[llvm-commits] [compiler-rt] r155344 - in /compiler-rt/trunk/lib/asan: asan_allocator.cc tests/asan_test.cc

Kostya Serebryany kcc at google.com
Mon Apr 23 03:08:16 PDT 2012


Author: kcc
Date: Mon Apr 23 05:08:16 2012
New Revision: 155344

URL: http://llvm.org/viewvc/llvm-project?rev=155344&view=rev
Log:
[asan] fix asan issue #66 (correctly report type of the bug)

Modified:
    compiler-rt/trunk/lib/asan/asan_allocator.cc
    compiler-rt/trunk/lib/asan/tests/asan_test.cc

Modified: compiler-rt/trunk/lib/asan/asan_allocator.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator.cc?rev=155344&r1=155343&r2=155344&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_allocator.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_allocator.cc Mon Apr 23 05:08:16 2012
@@ -498,6 +498,7 @@
 
     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);
 

Modified: compiler-rt/trunk/lib/asan/tests/asan_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_test.cc?rev=155344&r1=155343&r2=155344&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_test.cc Mon Apr 23 05:08:16 2012
@@ -1835,12 +1835,12 @@
 }
 
 // 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);
 }
 





More information about the llvm-commits mailing list