From 805c262fd7597188635a66f6ed85c7edd31dca48 Mon Sep 17 00:00:00 2001 From: marxin Date: Thu, 27 Dec 2018 09:47:20 +0000 Subject: [PATCH] Cherry pick libsanitizer patch (https://reviews.llvm.org/D54856). 2018-12-27 Martin Liska PR sanitizer/86229 * asan/asan_errors.cc (ErrorAllocTypeMismatch::Print): Cherry pick rL350085. * asan/asan_errors.h (struct ErrorAllocTypeMismatch): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@267432 138bc75d-0d04-0410-961f-82ee72b054a4 (cherry picked from commit 27e7ab5c4e8aa2c89a5e9b91d1b4eb60a435b14f) Change-Id: I016920774a6215f7a638cab88f268baeff049601 --- libsanitizer/ChangeLog | 7 +++++++ libsanitizer/asan/asan_errors.cc | 2 +- libsanitizer/asan/asan_errors.h | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog index 3578de6..3057e75 100644 --- a/libsanitizer/ChangeLog +++ b/libsanitizer/ChangeLog @@ -1,3 +1,10 @@ +2018-12-27 Martin Liska + + PR sanitizer/86229 + * asan/asan_errors.cc (ErrorAllocTypeMismatch::Print): Cherry + pick rL350085. + * asan/asan_errors.h (struct ErrorAllocTypeMismatch): Likewise. + 2018-06-13 Denis Khalikov PR sanitizer/86090 diff --git a/libsanitizer/asan/asan_errors.cc b/libsanitizer/asan/asan_errors.cc index 73c4cca..ec05bd7 100644 --- a/libsanitizer/asan/asan_errors.cc +++ b/libsanitizer/asan/asan_errors.cc @@ -151,7 +151,7 @@ void ErrorAllocTypeMismatch::Print() { Printf("%s", d.Warning()); Report("ERROR: AddressSanitizer: alloc-dealloc-mismatch (%s vs %s) on %p\n", alloc_names[alloc_type], dealloc_names[dealloc_type], - addr_description.addr); + addr_description.Address()); Printf("%s", d.EndWarning()); CHECK_GT(dealloc_stack->size, 0); scariness.Print(); diff --git a/libsanitizer/asan/asan_errors.h b/libsanitizer/asan/asan_errors.h index 6262dcf..1ffd994 100644 --- a/libsanitizer/asan/asan_errors.h +++ b/libsanitizer/asan/asan_errors.h @@ -140,8 +140,8 @@ struct ErrorFreeNotMalloced : ErrorBase { struct ErrorAllocTypeMismatch : ErrorBase { // ErrorAllocTypeMismatch doesn't own the stack trace. const BufferedStackTrace *dealloc_stack; - HeapAddressDescription addr_description; AllocType alloc_type, dealloc_type; + AddressDescription addr_description; // VS2013 doesn't implement unrestricted unions, so we need a trivial default // constructor ErrorAllocTypeMismatch() = default; @@ -150,8 +150,8 @@ struct ErrorAllocTypeMismatch : ErrorBase { : ErrorBase(tid), 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) { scariness.Clear(); scariness.Scare(10, "alloc-dealloc-mismatch"); }; -- 2.7.4