1515#define SANITIZER_ALLOCATOR_DLSYM_H
1616
1717#include " sanitizer_allocator_internal.h"
18+ #include " sanitizer_common/sanitizer_allocator_checks.h"
19+ #include " sanitizer_common/sanitizer_internal_defs.h"
1820
1921namespace __sanitizer {
2022
@@ -31,15 +33,15 @@ struct DlSymAllocator {
3133 UNLIKELY (internal_allocator ()->FromPrimary (ptr));
3234 }
3335
34- static void *Allocate (uptr size_in_bytes) {
35- void *ptr = InternalAlloc (size_in_bytes, nullptr , kWordSize );
36+ static void *Allocate (uptr size_in_bytes, uptr align = kWordSize ) {
37+ void *ptr = InternalAlloc (size_in_bytes, nullptr , align );
3638 CHECK (internal_allocator ()->FromPrimary (ptr));
3739 Details::OnAllocate (ptr,
3840 internal_allocator ()->GetActuallyAllocatedSize (ptr));
3941 return ptr;
4042 }
4143
42- static void *Callocate (SIZE_T nmemb, SIZE_T size) {
44+ static void *Callocate (usize nmemb, usize size) {
4345 void *ptr = InternalCalloc (nmemb, size);
4446 CHECK (internal_allocator ()->FromPrimary (ptr));
4547 Details::OnAllocate (ptr,
@@ -70,6 +72,11 @@ struct DlSymAllocator {
7072 return new_ptr;
7173 }
7274
75+ static void *ReallocArray (void *ptr, uptr count, uptr size) {
76+ CHECK (!CheckForCallocOverflow (count, size));
77+ return Realloc (ptr, count * size);
78+ }
79+
7380 static void OnAllocate (const void *ptr, uptr size) {}
7481 static void OnFree (const void *ptr, uptr size) {}
7582};
0 commit comments