[llvm] r271130 - Tighten some of the name map checks further
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Sat May 28 11:03:50 PDT 2016
Author: majnemer
Date: Sat May 28 13:03:37 2016
New Revision: 271130
URL: http://llvm.org/viewvc/llvm-project?rev=271130&view=rev
Log:
Tighten some of the name map checks further
Modified:
llvm/trunk/lib/DebugInfo/PDB/Raw/NameMap.cpp
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/NameMap.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/NameMap.cpp?rev=271130&r1=271129&r2=271130&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/NameMap.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/NameMap.cpp Sat May 28 13:03:37 2016
@@ -50,7 +50,11 @@ Error NameMap::load(codeview::StreamRead
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'.
More information about the llvm-commits
mailing list