diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2019-01-06 16:38:32 +0100 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2019-01-06 17:45:53 +0100 |
commit | ca126d490b0ff6960e135f3c77b2b2d4892a5744 (patch) | |
tree | f7255fed8ac1451d6438eb058f640cc58f0fe0a8 /src/support/allocators | |
parent | 9c719987718d9fcc3a689e50f5212acc7ead7606 (diff) |
Fix out-of-bounds write in case of failing mmap(...) in PosixLockedPageAllocator::AllocateLocked
Diffstat (limited to 'src/support/allocators')
-rw-r--r-- | src/support/allocators/secure.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/support/allocators/secure.h b/src/support/allocators/secure.h index 7cd0df135d..57f5b1f733 100644 --- a/src/support/allocators/secure.h +++ b/src/support/allocators/secure.h @@ -40,7 +40,11 @@ struct secure_allocator : public std::allocator<T> { T* allocate(std::size_t n, const void* hint = 0) { - return static_cast<T*>(LockedPoolManager::Instance().alloc(sizeof(T) * n)); + T* allocation = static_cast<T*>(LockedPoolManager::Instance().alloc(sizeof(T) * n)); + if (!allocation) { + throw std::bad_alloc(); + } + return allocation; } void deallocate(T* p, std::size_t n) |