diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2017-05-19 13:31:45 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2017-05-19 13:31:45 +0300 |
commit | 459643355ae99a1b87a01685b97bd0e947b4e552 (patch) | |
tree | 7e7a597833184b304f2a32caecb94f1903773112 | |
parent | hardening (diff) | |
download | winapi-debug-459643355ae99a1b87a01685b97bd0e947b4e552.tar.gz winapi-debug-459643355ae99a1b87a01685b97bd0e947b4e552.zip |
hardening
-rw-r--r-- | src/dbghelp.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
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; } |