Index: test/asan/TestCases/Posix/new_array_cookie_with_new_from_class.cc =================================================================== --- test/asan/TestCases/Posix/new_array_cookie_with_new_from_class.cc +++ /dev/null @@ -1,40 +0,0 @@ -// Test that we do not poison the array cookie if the operator new is defined -// inside the class. -// RUN: %clangxx_asan %s -o %t && %run %t -// -// XFAIL: arm - -// UNSUPPORTED: ios - -#include -#include -#include -#include -#include -struct Foo { - void *operator new(size_t s) { return Allocate(s); } - void *operator new[] (size_t s) { return Allocate(s); } - ~Foo(); - static void *allocated; - static void *Allocate(size_t s) { - assert(!allocated); - return allocated = ::new char[s]; - } -}; - -Foo::~Foo() {} -void *Foo::allocated; - -Foo *getFoo(size_t n) { - return new Foo[n]; -} - -int main() { - Foo *foo = getFoo(10); - fprintf(stderr, "foo : %p\n", foo); - fprintf(stderr, "alloc: %p\n", Foo::allocated); - assert(reinterpret_cast(foo) == - reinterpret_cast(Foo::allocated) + sizeof(void*)); - *reinterpret_cast(Foo::allocated) = 42; - return 0; -}