Tighten some of the name map checks further
llvm-svn: 271130
diff --git a/llvm/lib/DebugInfo/PDB/Raw/NameMap.cpp b/llvm/lib/DebugInfo/PDB/Raw/NameMap.cpp
index ad60a44..62a86da 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/NameMap.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/NameMap.cpp
@@ -50,7 +50,11 @@
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'.