15
15
#define SANITIZER_ALLOCATOR_DLSYM_H
16
16
17
17
#include " sanitizer_allocator_internal.h"
18
+ #include " sanitizer_common/sanitizer_allocator_checks.h"
19
+ #include " sanitizer_common/sanitizer_internal_defs.h"
18
20
19
21
namespace __sanitizer {
20
22
@@ -31,15 +33,15 @@ struct DlSymAllocator {
31
33
UNLIKELY (internal_allocator ()->FromPrimary (ptr));
32
34
}
33
35
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 );
36
38
CHECK (internal_allocator ()->FromPrimary (ptr));
37
39
Details::OnAllocate (ptr,
38
40
internal_allocator ()->GetActuallyAllocatedSize (ptr));
39
41
return ptr;
40
42
}
41
43
42
- static void *Callocate (SIZE_T nmemb, SIZE_T size) {
44
+ static void *Callocate (usize nmemb, usize size) {
43
45
void *ptr = InternalCalloc (nmemb, size);
44
46
CHECK (internal_allocator ()->FromPrimary (ptr));
45
47
Details::OnAllocate (ptr,
@@ -70,6 +72,11 @@ struct DlSymAllocator {
70
72
return new_ptr;
71
73
}
72
74
75
+ static void *ReallocArray (void *ptr, uptr count, uptr size) {
76
+ CHECK (!CheckForCallocOverflow (count, size));
77
+ return Realloc (ptr, count * size);
78
+ }
79
+
73
80
static void OnAllocate (const void *ptr, uptr size) {}
74
81
static void OnFree (const void *ptr, uptr size) {}
75
82
};
0 commit comments