[llvm-commits] [compiler-rt] r146501 - in /compiler-rt/trunk/lib/asan: asan_allocator.cc asan_interceptors.cc tests/asan_test.cc
Kostya Serebryany
kcc at google.com
Tue Dec 13 11:16:36 PST 2011
Author: kcc
Date: Tue Dec 13 13:16:36 2011
New Revision: 146501
URL: http://llvm.org/viewvc/llvm-project?rev=146501&view=rev
Log:
[asan] canonicalise the output for double-free and wrong-free. fixes asan issue 18
Modified:
compiler-rt/trunk/lib/asan/asan_allocator.cc
compiler-rt/trunk/lib/asan/asan_interceptors.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=146501&r1=146500&r2=146501&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_allocator.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_allocator.cc Tue Dec 13 13:16:36 2011
@@ -690,12 +690,13 @@
// Printf("Deallocate %p\n", ptr);
AsanChunk *m = PtrToChunk((uintptr_t)ptr);
if (m->chunk_state == CHUNK_QUARANTINE) {
- Printf("attempting double-free on %p:\n", ptr);
+ Report("ERROR: AddressSanitizer attempting double-free on %p:\n", ptr);
stack->PrintStack();
m->DescribeAddress((uintptr_t)ptr, 1);
ShowStatsAndAbort();
} else if (m->chunk_state != CHUNK_ALLOCATED) {
- Printf("attempting free on address which was not malloc()-ed: %p\n", ptr);
+ Report("ERROR: AddressSanitizer attempting free on address which was not"
+ " malloc()-ed: %p\n", ptr);
stack->PrintStack();
ShowStatsAndAbort();
}
Modified: compiler-rt/trunk/lib/asan/asan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.cc?rev=146501&r1=146500&r2=146501&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.cc Tue Dec 13 13:16:36 2011
@@ -84,7 +84,7 @@
const char *offset2 = (const char*)_offset2; \
if (RangesOverlap((const char*)offset1, (const char*)offset2, \
length)) { \
- Printf("ERROR: AddressSanitizer strcpy-param-overlap: " \
+ Report("ERROR: AddressSanitizer strcpy-param-overlap: " \
"memory ranges [%p,%p) and [%p, %p) overlap\n", \
offset1, offset1 + length, offset2, offset2 + length); \
PRINT_CURRENT_STACK(); \
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=146501&r1=146500&r2=146501&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_test.cc Tue Dec 13 13:16:36 2011
@@ -606,7 +606,8 @@
}
TEST(AddressSanitizer, WrongFreeTest) {
- EXPECT_DEATH(WrongFree(), "attempting free.*not malloc");
+ EXPECT_DEATH(WrongFree(),
+ "ERROR: AddressSanitizer attempting free.*not malloc");
}
void DoubleFree() {
@@ -619,7 +620,7 @@
}
TEST(AddressSanitizer, DoubleFreeTest) {
- EXPECT_DEATH(DoubleFree(), "attempting double-free");
+ EXPECT_DEATH(DoubleFree(), "ERROR: AddressSanitizer attempting double-free");
}
template<int kSize>
More information about the llvm-commits
mailing list