From 459643355ae99a1b87a01685b97bd0e947b4e552 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 19 May 2017 13:31:45 +0300 Subject: hardening --- src/dbghelp.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/dbghelp.cpp b/src/dbghelp.cpp index cd9b765..7d94f8b 100644 --- a/src/dbghelp.cpp +++ b/src/dbghelp.cpp @@ -40,11 +40,15 @@ namespace pdb throw error::windows(GetLastError()); } + Address next_offline_base = 0x10000000; + Address gen_next_offline_base(std::size_t pdb_size) { - static Address id = 0x10000000; - const auto base = id; - if (!msl::utilities::SafeAdd(id, pdb_size, id)) + const auto base = next_offline_base; + if (!msl::utilities::SafeAdd( + next_offline_base, + pdb_size, + next_offline_base)) throw std::runtime_error{"no more PDB files can be added, the internal address space is exhausted"}; return base; } -- cgit v1.2.3