[compiler-rt] r187980 - tsan: better diagnostics for invalid addresses passed to free()
Dmitry Vyukov
dvyukov at google.com
Thu Aug 8 06:47:51 PDT 2013
Author: dvyukov
Date: Thu Aug 8 08:47:50 2013
New Revision: 187980
URL: http://llvm.org/viewvc/llvm-project?rev=187980&view=rev
Log:
tsan: better diagnostics for invalid addresses passed to free()
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h?rev=187980&r1=187979&r2=187980&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h Thu Aug 8 08:47:50 2013
@@ -1016,7 +1016,10 @@ class LargeMmapAllocator {
// At least page_size_/2 metadata bytes is available.
void *GetMetaData(const void *p) {
// Too slow: CHECK_EQ(p, GetBlockBegin(p));
- CHECK(IsAligned(reinterpret_cast<uptr>(p), page_size_));
+ if (!IsAligned(reinterpret_cast<uptr>(p), page_size_)) {
+ Printf("%s: bad pointer %p\n", SanitizerToolName, p);
+ CHECK(IsAligned(reinterpret_cast<uptr>(p), page_size_));
+ }
return GetHeader(p) + 1;
}
More information about the llvm-commits
mailing list