[pdbdump] Verify the size of TPI hash records.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271954 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rui Ueyama 2016-06-06 23:19:23 +00:00
parent 6039b79bbe
commit d97680dbf0

View File

@ -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;