diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-03-24 12:08:08 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-03-24 12:17:29 +0300 |
commit | 368537c7f4fc74f60be1e4e211f488b7dab654a7 (patch) | |
tree | 2a88ffa7ae59341b4ea849f20a9229a7c556db92 /src/symbol.cpp | |
parent | WIP (diff) | |
download | winapi-debug-368537c7f4fc74f60be1e4e211f488b7dab654a7.tar.gz winapi-debug-368537c7f4fc74f60be1e4e211f488b7dab654a7.zip |
fix a bug where I failed to account for TCHARs, again
Diffstat (limited to '')
-rw-r--r-- | src/symbol.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/symbol.cpp b/src/symbol.cpp index 1973f0b..3b0f5d9 100644 --- a/src/symbol.cpp +++ b/src/symbol.cpp @@ -16,13 +16,15 @@ #include <cstring> #include <stdexcept> #include <string> +#include <type_traits> namespace pdb { namespace { std::size_t calc_size(const SymbolInfo::Impl& impl) { try { - return SafeInt<std::size_t>{impl.SizeOfStruct} + impl.NameLen - 1; + static constexpr auto char_size = sizeof(std::remove_extent<decltype(impl.Name)>::type); + return SafeInt<std::size_t>{impl.SizeOfStruct} + (impl.NameLen - 1) * char_size; } catch (const SafeIntException&) { throw std::runtime_error{"invalid SYMBOL_INFO size"}; } |