1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[pdbdump] Verify the size of TPI hash records.

llvm-svn: 271954
This commit is contained in:
Rui Ueyama 2016-06-06 23:19:23 +00:00
parent d32e283fe4
commit f72bd6fe60

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;