[asan] better warning messages for double-free bugs (provide allocation/deallocation stack traces)
llvm-svn: 150027
This commit is contained in:
parent
f76dd56dd3
commit
9716914b2d
|
@ -686,7 +686,7 @@ static void Deallocate(uint8_t *ptr, AsanStackTrace *stack) {
|
|||
if (m->chunk_state == CHUNK_QUARANTINE) {
|
||||
Report("ERROR: AddressSanitizer attempting double-free on %p:\n", ptr);
|
||||
stack->PrintStack();
|
||||
m->DescribeAddress((uintptr_t)ptr, 1);
|
||||
Describe((uintptr_t)ptr, 1);
|
||||
ShowStatsAndAbort();
|
||||
} else if (m->chunk_state != CHUNK_ALLOCATED) {
|
||||
Report("ERROR: AddressSanitizer attempting free on address which was not"
|
||||
|
|
|
@ -564,7 +564,11 @@ void DoubleFree() {
|
|||
}
|
||||
|
||||
TEST(AddressSanitizer, DoubleFreeTest) {
|
||||
EXPECT_DEATH(DoubleFree(), "ERROR: AddressSanitizer attempting double-free");
|
||||
EXPECT_DEATH(DoubleFree(), ASAN_PCRE_DOTALL
|
||||
"ERROR: AddressSanitizer attempting double-free"
|
||||
".*is located 0 bytes inside of 400-byte region"
|
||||
".*freed by thread T0 here"
|
||||
".*previously allocated by thread T0 here");
|
||||
}
|
||||
|
||||
template<int kSize>
|
||||
|
|
Loading…
Reference in New Issue