summaryrefslogtreecommitdiff
path: root/lib/asan
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2018-12-27 08:39:13 +0000
committerMartin Liska <mliska@suse.cz>2018-12-27 08:39:13 +0000
commit41ff34a5c702eadaff1679c9c9386d175bad04f2 (patch)
tree35f1437aa213252ce131055ccaf21d3d0d59d1d7 /lib/asan
parent8d865663ccccbd53940f83365be7727863622853 (diff)
downloadcompiler-rt-41ff34a5c702eadaff1679c9c9386d175bad04f2.tar.gz
Do not rely on that subject of ErrorAllocTypeMismatch is a heap address.
Differential Revision: https://reviews.llvm.org/D54856. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@350085 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan')
-rw-r--r--lib/asan/asan_errors.cc5
-rw-r--r--lib/asan/asan_errors.h7
2 files changed, 5 insertions, 7 deletions
diff --git a/lib/asan/asan_errors.cc b/lib/asan/asan_errors.cc
index 33d0613f7..0ecd30dca 100644
--- a/lib/asan/asan_errors.cc
+++ b/lib/asan/asan_errors.cc
@@ -125,9 +125,8 @@ void ErrorAllocTypeMismatch::Print() {
Decorator d;
Printf("%s", d.Error());
Report("ERROR: AddressSanitizer: %s (%s vs %s) on %p\n",
- scariness.GetDescription(),
- alloc_names[alloc_type], dealloc_names[dealloc_type],
- addr_description.addr);
+ scariness.GetDescription(), alloc_names[alloc_type],
+ dealloc_names[dealloc_type], addr_description.Address());
Printf("%s", d.Default());
CHECK_GT(dealloc_stack->size, 0);
scariness.Print();
diff --git a/lib/asan/asan_errors.h b/lib/asan/asan_errors.h
index 574197ebf..7ddd7e94e 100644
--- a/lib/asan/asan_errors.h
+++ b/lib/asan/asan_errors.h
@@ -110,8 +110,8 @@ struct ErrorFreeNotMalloced : ErrorBase {
struct ErrorAllocTypeMismatch : ErrorBase {
const BufferedStackTrace *dealloc_stack;
- HeapAddressDescription addr_description;
AllocType alloc_type, dealloc_type;
+ AddressDescription addr_description;
ErrorAllocTypeMismatch() = default; // (*)
ErrorAllocTypeMismatch(u32 tid, BufferedStackTrace *stack, uptr addr,
@@ -119,9 +119,8 @@ struct ErrorAllocTypeMismatch : ErrorBase {
: ErrorBase(tid, 10, "alloc-dealloc-mismatch"),
dealloc_stack(stack),
alloc_type(alloc_type_),
- dealloc_type(dealloc_type_) {
- GetHeapAddressInformation(addr, 1, &addr_description);
- };
+ dealloc_type(dealloc_type_),
+ addr_description(addr, 1, false) {}
void Print();
};