summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-pdbutil/InputFile.cpp
diff options
context:
space:
mode:
authorAlexandre Ganea <alexandre.ganea@ubisoft.com>2018-08-06 19:35:00 +0000
committerAlexandre Ganea <alexandre.ganea@ubisoft.com>2018-08-06 19:35:00 +0000
commit741cc3531a6a372f8b5524362eb7930905e983bb (patch)
tree0a90eb27065bb21273accebf4ff6dab242e95121 /llvm/tools/llvm-pdbutil/InputFile.cpp
parent7c4f4914e34a3844475deb5cc5a9fdd481361d3e (diff)
downloadbcm5719-llvm-741cc3531a6a372f8b5524362eb7930905e983bb.tar.gz
bcm5719-llvm-741cc3531a6a372f8b5524362eb7930905e983bb.zip
[llvm-pdbutil] Support PDBs without a DBI stream
Differential Revision: https://reviews.llvm.org/D50258 llvm-svn: 339045
Diffstat (limited to 'llvm/tools/llvm-pdbutil/InputFile.cpp')
-rw-r--r--llvm/tools/llvm-pdbutil/InputFile.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/tools/llvm-pdbutil/InputFile.cpp b/llvm/tools/llvm-pdbutil/InputFile.cpp
index 7b5af7e9692..b2019642b2b 100644
--- a/llvm/tools/llvm-pdbutil/InputFile.cpp
+++ b/llvm/tools/llvm-pdbutil/InputFile.cpp
@@ -41,6 +41,10 @@ getModuleDebugStream(PDBFile &File, StringRef &ModuleName, uint32_t Index) {
auto &Dbi = Err(File.getPDBDbiStream());
const auto &Modules = Dbi.modules();
+ if (Index >= Modules.getModuleCount())
+ return make_error<RawError>(raw_error_code::index_out_of_bounds,
+ "Invalid module index");
+
auto Modi = Modules.getModuleDescriptor(Index);
ModuleName = Modi.getModuleName();
OpenPOWER on IntegriCloud