aboutsummaryrefslogtreecommitdiff
path: root/osi/src/allocator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'osi/src/allocator.cc')
-rw-r--r--osi/src/allocator.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/osi/src/allocator.cc b/osi/src/allocator.cc
index 1c0449e14..e2c356dd3 100644
--- a/osi/src/allocator.cc
+++ b/osi/src/allocator.cc
@@ -56,6 +56,7 @@ char* osi_strndup(const char* str, size_t len) {
}
void* osi_malloc(size_t size) {
+ CHECK(static_cast<ssize_t>(size) >= 0);
size_t real_size = allocation_tracker_resize_for_canary(size);
void* ptr = malloc(real_size);
CHECK(ptr);
@@ -63,6 +64,7 @@ void* osi_malloc(size_t size) {
}
void* osi_calloc(size_t size) {
+ CHECK(static_cast<ssize_t>(size) >= 0);
size_t real_size = allocation_tracker_resize_for_canary(size);
void* ptr = calloc(1, real_size);
CHECK(ptr);