#include "interception/interception.h"
#include "nsan.h"
#include "nsan_allocator.h"
#include "sanitizer_common/sanitizer_allocator_dlsym.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_platform.h"
#include "sanitizer_common/sanitizer_platform_interceptors.h"
#include "sanitizer_common/sanitizer_stacktrace.h"
#if !SANITIZER_APPLE && !SANITIZER_WINDOWS
usingnamespace__sanitizer;
usingnamespace__nsan;
namespace {
struct DlsymAlloc : public DlSymAllocator<DlsymAlloc> { … };
}
INTERCEPTOR(void *, aligned_alloc, uptr align, uptr size) { … }
INTERCEPTOR(void *, calloc, uptr nmemb, uptr size) { … }
INTERCEPTOR(void, free, void *ptr) { … }
INTERCEPTOR(void *, malloc, uptr size) { … }
INTERCEPTOR(void *, realloc, void *ptr, uptr size) { … }
#if SANITIZER_INTERCEPT_REALLOCARRAY
INTERCEPTOR(void *, reallocarray, void *ptr, uptr nmemb, uptr size) { … }
#endif
INTERCEPTOR(int, posix_memalign, void **memptr, uptr align, uptr size) { … }
#if SANITIZER_INTERCEPT_MEMALIGN
INTERCEPTOR(void *, memalign, uptr align, uptr size) { … }
INTERCEPTOR(void *, __libc_memalign, uptr align, uptr size) { … }
#endif
void __nsan::InitializeMallocInterceptors() { … }
#endif