[llvm-pdbutil] Don't crash when a section contrib's isect is invalid.

llvm-svn: 310298
This commit is contained in:
Zachary Turner 2017-08-07 20:24:01 +00:00
parent 676386ff30
commit 489a7a09ad
1 changed files with 6 additions and 2 deletions

View File

@ -1180,8 +1180,12 @@ Error DumpOutputStyle::dumpSectionContribs() {
}
void visit(const SectionContrib &SC) override {
assert(SC.ISect > 0);
StringRef SectionName = Names[SC.ISect - 1];
std::string NameInsert = formatv("[{0}]", SectionName).str();
std::string NameInsert;
if (SC.ISect < Names.size()) {
StringRef SectionName = Names[SC.ISect - 1];
NameInsert = formatv("[{0}]", SectionName).str();
} else
NameInsert = "[???]";
P.formatLine("SC{5} | mod = {2}, {0}, size = {1}, data crc = {3}, reloc "
"crc = {4}",
formatSegmentOffset(SC.ISect, SC.Off), fmtle(SC.Size),