[SymbolDumper] Validate the string table offset before using it

llvm-svn: 271145
This commit is contained in:
David Majnemer 2016-05-28 20:04:46 +00:00
parent 898eb39bfc
commit c6cb2ec36e
1 changed files with 6 additions and 6 deletions

View File

@ -591,12 +591,12 @@ void CVSymbolDumperImpl::visitDefRangeSubfieldSym(
if (ObjDelegate) {
StringRef StringTable = ObjDelegate->getStringTable();
if (!StringTable.empty()) {
W.printString("Program",
StringTable.drop_front(DefRangeSubfield.Header.Program)
.split('\0')
.first);
}
auto ProgramStringTableOffset = DefRangeSubfield.Header.Program;
if (ProgramStringTableOffset >= StringTable.size())
return parseError();
StringRef Program =
StringTable.drop_front(ProgramStringTableOffset).split('\0').first;
W.printString("Program", Program);
}
W.printNumber("OffsetInParent", DefRangeSubfield.Header.OffsetInParent);
printLocalVariableAddrRange(DefRangeSubfield.Header.Range,