[llvm] r271142 - [SymbolDumper] Validate the string table offset before using it
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Sat May 28 12:45:56 PDT 2016
Author: majnemer
Date: Sat May 28 14:45:56 2016
New Revision: 271142
URL: http://llvm.org/viewvc/llvm-project?rev=271142&view=rev
Log:
[SymbolDumper] Validate the string table offset before using it
Modified:
llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp
Modified: llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp?rev=271142&r1=271141&r2=271142&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp Sat May 28 14:45:56 2016
@@ -610,11 +610,12 @@ void CVSymbolDumperImpl::visitDefRangeSy
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());
More information about the llvm-commits
mailing list