From 7e950b261ab2da7b385f01dae7afd1f38b87659b Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sat, 28 May 2016 05:59:19 +0000 Subject: Make sure the directory contains info for all streams llvm-svn: 271103 --- llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'llvm/lib') 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( + 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(raw_error_code::corrupt_file, "The number of stream blocks is not " -- cgit v1.2.3