aboutsummaryrefslogtreecommitdiff
path: root/src/support/lockedpool.cpp
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2019-01-06 16:38:32 +0100
committerpracticalswift <practicalswift@users.noreply.github.com>2019-01-06 17:45:53 +0100
commitca126d490b0ff6960e135f3c77b2b2d4892a5744 (patch)
treef7255fed8ac1451d6438eb058f640cc58f0fe0a8 /src/support/lockedpool.cpp
parent9c719987718d9fcc3a689e50f5212acc7ead7606 (diff)
Fix out-of-bounds write in case of failing mmap(...) in PosixLockedPageAllocator::AllocateLocked
Diffstat (limited to 'src/support/lockedpool.cpp')
-rw-r--r--src/support/lockedpool.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/support/lockedpool.cpp b/src/support/lockedpool.cpp
index 8d577cf521..627018083e 100644
--- a/src/support/lockedpool.cpp
+++ b/src/support/lockedpool.cpp
@@ -248,6 +248,9 @@ void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess)
void *addr;
len = align_up(len, page_size);
addr = mmap(nullptr, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+ if (addr == MAP_FAILED) {
+ return nullptr;
+ }
if (addr) {
*lockingSuccess = mlock(addr, len) == 0;
}