diff options
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/NameMap.cpp')
| -rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/NameMap.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/NameMap.cpp b/llvm/lib/DebugInfo/PDB/Raw/NameMap.cpp index ad60a44a52d..62a86dac038 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/NameMap.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/NameMap.cpp @@ -50,7 +50,11 @@ Error NameMap::load(codeview::StreamReader &Stream) { make_error<RawError>(raw_error_code::corrupt_file, "Expected name map max strings")); - const uint32_t MaxNumberOfWords = UINT32_MAX / sizeof(uint32_t); + if (MaxNumberOfStrings > (UINT32_MAX / sizeof(uint32_t))) + return make_error<RawError>(raw_error_code::corrupt_file, + "Implausible number of strings"); + + const uint32_t MaxNumberOfWords = UINT32_MAX / (sizeof(uint32_t) * 8); // This appears to be a hash table which uses bitfields to determine whether // or not a bucket is 'present'. |

