diff options
author | Jack Lloyd <[email protected]> | 2017-09-29 18:55:06 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-09-29 18:55:06 -0400 |
commit | e4e077290cff8e2ce8ef174f41bae94e4106adf6 (patch) | |
tree | 3f886eb30f9b438e62befe0919c26058c41aace3 /src/lib | |
parent | 1d64169d941b3be81937c341e1b8e38cb5155057 (diff) |
Avoid throwing in pool allocator deallocation path
std::terminate can ruin your day
Coverity find
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/utils/locking_allocator/locking_allocator.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/lib/utils/locking_allocator/locking_allocator.cpp b/src/lib/utils/locking_allocator/locking_allocator.cpp index bdd675af1..880f3add8 100644 --- a/src/lib/utils/locking_allocator/locking_allocator.cpp +++ b/src/lib/utils/locking_allocator/locking_allocator.cpp @@ -22,14 +22,7 @@ bool ptr_in_pool(const void* pool_ptr, size_t poolsize, { const uintptr_t pool = reinterpret_cast<uintptr_t>(pool_ptr); const uintptr_t buf = reinterpret_cast<uintptr_t>(buf_ptr); - - if(buf < pool || buf >= pool + poolsize) - return false; - - BOTAN_ASSERT(buf + bufsize <= pool + poolsize, - "Pointer does not partially overlap pool"); - - return true; + return (buf >= pool) && (buf + bufsize <= pool + poolsize); } size_t padding_for_alignment(size_t offset, size_t desired_alignment) |