diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2016-05-28 18:03:37 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2016-05-28 18:03:37 +0000 |
| commit | 328b6d3903f6c89d0929ce94ba46c613f16afcfb (patch) | |
| tree | 21cf4c8b53c50a0b8af979dc71720cce53342a27 /llvm/lib/DebugInfo/PDB | |
| parent | bcc47419d9a88e6b58a9e2a7c0ee4c7bf43e91b4 (diff) | |
| download | bcm5719-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.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'. |

