diff options
author | Chris Manton <cmanton@google.com> | 2021-10-06 18:09:13 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-10-06 18:09:13 +0000 |
commit | ec15c0798b8c5c813a6da49e0faa471c38b953ec (patch) | |
tree | eab450126d9f541b67430405234165c023ac3eae | |
parent | 03fbe4189194e76b9b278f79b8422c8246961226 (diff) | |
parent | e435404a7d2afa6b4cb9a59319667bf72af4df1f (diff) | |
download | bt-ec15c0798b8c5c813a6da49e0faa471c38b953ec.tar.gz |
osi: Prevent memory allocations with MSB set am: e435404a7d
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bt/+/15959600
Change-Id: I977f1225ea250ef304b79efd475440f248bd557d
-rw-r--r-- | osi/src/allocator.cc | 2 |
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); |