summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-05-28 18:03:37 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-05-28 18:03:37 +0000
commit328b6d3903f6c89d0929ce94ba46c613f16afcfb (patch)
tree21cf4c8b53c50a0b8af979dc71720cce53342a27 /llvm/lib/DebugInfo/PDB
parentbcc47419d9a88e6b58a9e2a7c0ee4c7bf43e91b4 (diff)
downloadbcm5719-llvm-328b6d3903f6c89d0929ce94ba46c613f16afcfb.tar.gz
bcm5719-llvm-328b6d3903f6c89d0929ce94ba46c613f16afcfb.zip
Tighten some of the name map checks further
llvm-svn: 271130
Diffstat (limited to 'llvm/lib/DebugInfo/PDB')
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/NameMap.cpp6
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'.
OpenPOWER on IntegriCloud