diff options
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp')
| -rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp | 11 | 
1 files changed, 8 insertions, 3 deletions
| diff --git a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp index 68ed6c82efd..d0fbb142ec3 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp @@ -269,10 +269,15 @@ Error PDBFile::parseStreamData() {      }    } -  for (uint32_t SI = 0; SI != NumStreams; ++SI) { +  if (Context->StreamSizes.size() != NumStreams) +    return make_error<RawError>( +        raw_error_code::corrupt_file, +        "The directory has fewer streams then expected"); + +  for (uint32_t I = 0; I != NumStreams; ++I) {      uint64_t NumExpectedStreamBlocks = -        bytesToBlocks(getStreamByteSize(SI), getBlockSize()); -    size_t NumStreamBlocks = getStreamBlockList(SI).size(); +        bytesToBlocks(getStreamByteSize(I), getBlockSize()); +    size_t NumStreamBlocks = getStreamBlockList(I).size();      if (NumExpectedStreamBlocks != NumStreamBlocks)        return make_error<RawError>(raw_error_code::corrupt_file,                                    "The number of stream blocks is not " | 

