diff options
author | Rui Ueyama <ruiu@google.com> | 2016-06-06 23:19:23 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-06-06 23:19:23 +0000 |
commit | ba0aab94ccbc315df02c14f0b6638b4088885781 (patch) | |
tree | 33297ef0dc580a2981f3f8ecf1f178ce4941e3b3 /llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp | |
parent | f051269a7fa77c5c25e8e632442503e8f97e7914 (diff) | |
download | llvm-ba0aab94ccbc315df02c14f0b6638b4088885781.zip llvm-ba0aab94ccbc315df02c14f0b6638b4088885781.tar.gz llvm-ba0aab94ccbc315df02c14f0b6638b4088885781.tar.bz2 |
[pdbdump] Verify the size of TPI hash records.
llvm-svn: 271954
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp index 8b9b7c8..11e10a5 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp @@ -103,7 +103,12 @@ Error TpiStream::reload() { // Hash indices, hash values, etc come from the hash stream. HashStream.reset(new MappedBlockStream(Header->HashStreamIndex, Pdb)); codeview::StreamReader HSR(*HashStream); + uint32_t NumHashValues = Header->HashValueBuffer.Length / sizeof(ulittle32_t); + if (NumHashValues != NumTypeRecords()) + return make_error<RawError>( + raw_error_code::corrupt_file, + "TPI hash count does not match with the number of type records."); HSR.setOffset(Header->HashValueBuffer.Off); if (auto EC = HSR.readArray(HashValues, NumHashValues)) return EC; |