aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-05-28 20:04:46 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-05-28 20:04:46 +0000
commitc6cb2ec36ea5a3c149b58a3bb28dccafaa8ceaa0 (patch)
tree13211614e99fbed17b89c094d4af067b1b105b2c /llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
parent898eb39bfcd8d06db670ede4363fcfb50d8f7816 (diff)
downloadllvm-c6cb2ec36ea5a3c149b58a3bb28dccafaa8ceaa0.zip
llvm-c6cb2ec36ea5a3c149b58a3bb28dccafaa8ceaa0.tar.gz
llvm-c6cb2ec36ea5a3c149b58a3bb28dccafaa8ceaa0.tar.bz2
[SymbolDumper] Validate the string table offset before using it
llvm-svn: 271145
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp')
-rw-r--r--llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp b/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
index 4afcdf1..3ce84ac 100644
--- a/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
+++ b/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
@@ -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,