diff options
Diffstat (limited to 'compiler-rt/lib/asan/tests/asan_test.cc')
| -rw-r--r-- | compiler-rt/lib/asan/tests/asan_test.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler-rt/lib/asan/tests/asan_test.cc b/compiler-rt/lib/asan/tests/asan_test.cc index bbccd21ee0e..aa4a19be91d 100644 --- a/compiler-rt/lib/asan/tests/asan_test.cc +++ b/compiler-rt/lib/asan/tests/asan_test.cc @@ -1902,10 +1902,20 @@ TEST(AddressSanitizer, BufferOverflowAfterManyFrees) { #include "asan_mac_test.h" TEST(AddressSanitizerMac, CFAllocatorDefaultDoubleFree) { EXPECT_DEATH( - CFAllocatorDefaultDoubleFree(), + CFAllocatorDefaultDoubleFree(NULL), "attempting double-free"); } +void CFAllocator_DoubleFreeOnPthread() { + pthread_t child; + pthread_create(&child, NULL, CFAllocatorDefaultDoubleFree, NULL); + pthread_join(child, NULL); // Shouldn't be reached. +} + +TEST(AddressSanitizerMac, DISABLED_CFAllocatorDefaultDoubleFree_ChildPhread) { + EXPECT_DEATH(CFAllocator_DoubleFreeOnPthread(), "attempting double-free"); +} + // TODO(glider): figure out whether we still need these tests. Is it correct // to intercept the non-default CFAllocators? TEST(AddressSanitizerMac, DISABLED_CFAllocatorSystemDefaultDoubleFree) { @@ -1914,6 +1924,7 @@ TEST(AddressSanitizerMac, DISABLED_CFAllocatorSystemDefaultDoubleFree) { "attempting double-free"); } +// We're intercepting malloc, so kCFAllocatorMalloc is routed to ASan. TEST(AddressSanitizerMac, CFAllocatorMallocDoubleFree) { EXPECT_DEATH(CFAllocatorMallocDoubleFree(), "attempting double-free"); } |

