summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-05-28 19:45:56 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-05-28 19:45:56 +0000
commitb343310b4f500f9274d1c659a3b9cab6ecce6651 (patch)
tree948392cb40df44fcd171c4fc37fdfc9faaaad636 /llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
parent0042e2099642843d1920c45301a454a2b634d5d9 (diff)
downloadbcm5719-llvm-b343310b4f500f9274d1c659a3b9cab6ecce6651.tar.gz
bcm5719-llvm-b343310b4f500f9274d1c659a3b9cab6ecce6651.zip
[SymbolDumper] Validate the string table offset before using it
llvm-svn: 271142
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp')
-rw-r--r--llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp b/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
index e2dc9d5b76d..4afcdf189f2 100644
--- a/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
+++ b/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
@@ -610,11 +610,12 @@ void CVSymbolDumperImpl::visitDefRangeSym(SymbolKind Kind,
if (ObjDelegate) {
StringRef StringTable = ObjDelegate->getStringTable();
- if (!StringTable.empty()) {
- W.printString(
- "Program",
- StringTable.drop_front(DefRange.Header.Program).split('\0').first);
- }
+ auto ProgramStringTableOffset = DefRange.Header.Program;
+ if (ProgramStringTableOffset >= StringTable.size())
+ return parseError();
+ StringRef Program =
+ StringTable.drop_front(ProgramStringTableOffset).split('\0').first;
+ W.printString("Program", Program);
}
printLocalVariableAddrRange(DefRange.Header.Range,
DefRange.getRelocationOffset());
OpenPOWER on IntegriCloud