Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DAC issue with redefined standard new / delete operators #55945

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/coreclr/utilcode/clrhost_nodependencies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ ClrDebugState *CLRInitDebugState()

const NoThrow nothrow = { 0 };

#ifdef HAS_ADDRESS_SANITIZER
#if defined(HAS_ADDRESS_SANITIZER) || defined(DACCESS_COMPILE)
// use standard heap functions for address santizier
#else

Expand Down Expand Up @@ -345,11 +345,11 @@ operator new[](size_t n)
return result;
};

#endif // HAS_ADDRESS_SANITIZER
#endif // HAS_ADDRESS_SANITIZER || DACCESS_COMPILE

void * __cdecl operator new(size_t n, const NoThrow&) NOEXCEPT
{
#ifdef HAS_ADDRESS_SANITIZER
#if defined(HAS_ADDRESS_SANITIZER) || defined(DACCESS_COMPILE)
// use standard heap functions for address santizier (which doesn't provide for NoThrow)
void * result = operator new(n);
#else
Expand All @@ -361,14 +361,14 @@ void * __cdecl operator new(size_t n, const NoThrow&) NOEXCEPT
INCONTRACT(_ASSERTE(!ARE_FAULTS_FORBIDDEN()));

void* result = ClrMalloc(n);
#endif // HAS_ADDRESS_SANITIZER
#endif // HAS_ADDRESS_SANITIZER || DACCESS_COMPILE
TRASH_LASTERROR;
return result;
}

void * __cdecl operator new[](size_t n, const NoThrow&) NOEXCEPT
{
#ifdef HAS_ADDRESS_SANITIZER
#if defined(HAS_ADDRESS_SANITIZER) || defined(DACCESS_COMPILE)
// use standard heap functions for address santizier (which doesn't provide for NoThrow)
void * result = operator new[](n);
#else
Expand All @@ -380,12 +380,12 @@ void * __cdecl operator new[](size_t n, const NoThrow&) NOEXCEPT
INCONTRACT(_ASSERTE(!ARE_FAULTS_FORBIDDEN()));

void* result = ClrMalloc(n);
#endif // HAS_ADDRESS_SANITIZER
#endif // HAS_ADDRESS_SANITIZER || DACCESS_COMPILE
TRASH_LASTERROR;
return result;
}

#ifdef HAS_ADDRESS_SANITIZER
#if defined(HAS_ADDRESS_SANITIZER) || defined(DACCESS_COMPILE)
// use standard heap functions for address santizier
#else
void __cdecl
Expand All @@ -411,7 +411,7 @@ operator delete[](void *p) NOEXCEPT
TRASH_LASTERROR;
}

#endif // HAS_ADDRESS_SANITIZER
#endif // HAS_ADDRESS_SANITIZER || DACCESS_COMPILE

/* ------------------------------------------------------------------------ *
* New operator overloading for the executable heap
Expand Down