Tighten some of the name map checks further

llvm-svn: 271130
This commit is contained in:
David Majnemer 2016-05-28 18:03:37 +00:00
parent bcc47419d9
commit 328b6d3903
1 changed files with 5 additions and 1 deletions

View File

@ -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'.