Skip to content

Commit

Permalink
fix warning about potential arithmetic overflow: remove unnecessary c…
Browse files Browse the repository at this point in the history
…alculations

https://github.com/work-examples/key-value-web-server-lock-free/security/code-scanning/73

Arithmetic overflow: Using operator '' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '' to avoid overflow (io.2).
  • Loading branch information
kolomenkin committed May 23, 2022
1 parent dff610e commit 8873683
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion AllocatorFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
const AllocatorFactory::DefaultAllocator& AllocatorFactory::get_current_thread_allocator()
{
static std::shared_mutex protect;
static std::unordered_map<std::thread::id, DefaultAllocator> allocators(std::thread::hardware_concurrency() * 2);
static std::unordered_map<std::thread::id, DefaultAllocator> allocators;

const std::thread::id threadId = std::this_thread::get_id();

Expand Down

0 comments on commit 8873683

Please sign in to comment.