diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-05-15 21:22:50 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-05-15 21:22:50 +0300 |
commit | f6af7c442df3e569492ced730e70d1bc72356c5e (patch) | |
tree | bd18c18acbc131bd43de99c9f03f698eff479a82 /src/process.cpp | |
parent | workflows/ci: build using VS 2015 also (diff) | |
download | winapi-debug-f6af7c442df3e569492ced730e70d1bc72356c5e.tar.gz winapi-debug-f6af7c442df3e569492ced730e70d1bc72356c5e.zip |
get rid of SafeInt
Diffstat (limited to '')
-rw-r--r-- | src/process.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/process.cpp b/src/process.cpp index 683312c..adb4b96 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -5,11 +5,11 @@ #include <pdb/all.hpp> -#include <SafeInt.hpp> #include <boost/nowide/convert.hpp> #include <windows.h> +#include <limits> #include <stdexcept> #include <string> #include <utility> @@ -41,9 +41,10 @@ public: if (size < min_size) { size = min_size; } else { - if (!SafeMultiply(size, 2, size)) { + // Check if we can still multiply by two. + if (std::numeric_limits<decltype(size)>::max() - size < size) throw std::range_error{"couldn't allocate buffer sufficient for a file path"}; - } + size *= 2; } data.resize(size); } |