diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2019-05-01 17:33:01 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2019-05-01 17:33:01 +0000 |
commit | cfcbff0d73bea1fece9c213fb7ed9eab27c125a6 (patch) | |
tree | 8ecb4a7fbee520b54cef28701d651cf92b9dfea7 /lib/hwasan/hwasan_interceptors.cpp | |
parent | 6cd423889971c0d97801a9f3b9b5afb91ae9c137 (diff) | |
download | compiler-rt-cfcbff0d73bea1fece9c213fb7ed9eab27c125a6.tar.gz |
[sanitizer] Implement reallocarray.
Summary:
It's a cross of calloc and realloc. Sanitizers implement calloc-like check for size
overflow.
Reviewers: vitalybuka, kcc
Subscribers: kubamracek, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D61108
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@359708 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/hwasan/hwasan_interceptors.cpp')
-rw-r--r-- | lib/hwasan/hwasan_interceptors.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/hwasan/hwasan_interceptors.cpp b/lib/hwasan/hwasan_interceptors.cpp index 326309751..e305f6b1b 100644 --- a/lib/hwasan/hwasan_interceptors.cpp +++ b/lib/hwasan/hwasan_interceptors.cpp @@ -178,6 +178,11 @@ void * __sanitizer_realloc(void *ptr, uptr size) { return hwasan_realloc(ptr, size, &stack); } +void * __sanitizer_reallocarray(void *ptr, uptr nmemb, uptr size) { + GET_MALLOC_STACK_TRACE; + return hwasan_reallocarray(ptr, nmemb, size, &stack); +} + void * __sanitizer_malloc(uptr size) { GET_MALLOC_STACK_TRACE; if (UNLIKELY(!hwasan_init_is_running)) @@ -204,6 +209,7 @@ INTERCEPTOR_ALIAS(void, free, void *ptr); INTERCEPTOR_ALIAS(uptr, malloc_usable_size, const void *ptr); INTERCEPTOR_ALIAS(void *, calloc, SIZE_T nmemb, SIZE_T size); INTERCEPTOR_ALIAS(void *, realloc, void *ptr, SIZE_T size); +INTERCEPTOR_ALIAS(void *, reallocarray, void *ptr, SIZE_T nmemb, SIZE_T size); INTERCEPTOR_ALIAS(void *, malloc, SIZE_T size); #if !SANITIZER_FREEBSD && !SANITIZER_NETBSD |