diff options
author | Filipe Cabecinhas <me@filcab.net> | 2016-08-31 07:38:09 +0000 |
---|---|---|
committer | Filipe Cabecinhas <me@filcab.net> | 2016-08-31 07:38:09 +0000 |
commit | 61f7c237877c813a3bae8b72c41f8dcdff2d0e97 (patch) | |
tree | 876439aaede31d5c28c441c65cc679ae26935a1c /lib/asan/asan_errors.h | |
parent | b0f82c0c385ed66f45f479f42a48bfeb71810128 (diff) |
Reify ErrorDoubleFree
Summary: Keep reifying other errors.
Reviewers: kcc, samsonov
Subscribers: llvm-commits, kubabrecka
Differential Revision: https://reviews.llvm.org/D23717
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280201 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_errors.h')
-rw-r--r-- | lib/asan/asan_errors.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/asan/asan_errors.h b/lib/asan/asan_errors.h index 87bc8690f..637bb44d2 100644 --- a/lib/asan/asan_errors.h +++ b/lib/asan/asan_errors.h @@ -44,9 +44,27 @@ struct ErrorStackOverflow : ErrorBase { void Print(); }; +struct ErrorDoubleFree : ErrorBase { + u32 tid; + HeapAddressDescription addr_description; + // ErrorDoubleFree doesn't own the stack trace. + BufferedStackTrace *second_free_stack; + // VS2013 doesn't implement unrestricted unions, so we need a trivial default + // constructor + ErrorDoubleFree() = default; + ErrorDoubleFree(uptr addr, u32 tid_, BufferedStackTrace *stack) + : tid(tid_), second_free_stack(stack) { + CHECK_GT(second_free_stack->size, 0); + GetHeapAddressInformation(addr, 1, &addr_description); + scariness.Scare(42, "double-free"); + } + void Print(); +}; + enum ErrorKind { kErrorKindInvalid = 0, kErrorKindStackOverflow, + kErrorKindDoubleFree, }; struct ErrorDescription { @@ -58,11 +76,15 @@ struct ErrorDescription { // add a lot of code and the benefit wouldn't be that big. union { ErrorStackOverflow stack_overflow; + ErrorDoubleFree double_free; }; ErrorDescription() { internal_memset(this, 0, sizeof(*this)); } ErrorDescription(const ErrorStackOverflow &e) // NOLINT : kind(kErrorKindStackOverflow), stack_overflow(e) {} + ErrorDescription(const ErrorDoubleFree &e) // NOLINT + : kind(kErrorKindDoubleFree), + double_free(e) {} bool IsValid() { return kind != kErrorKindInvalid; } void Print() { @@ -70,6 +92,9 @@ struct ErrorDescription { case kErrorKindStackOverflow: stack_overflow.Print(); return; + case kErrorKindDoubleFree: + double_free.Print(); + return; case kErrorKindInvalid: CHECK(0); } |