summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2017-05-04 18:29:44 +0000
committerGreg Clayton <gclayton@apple.com>2017-05-04 18:29:44 +0000
commit48ff66a28098afd7c3bd593adb45a8d8d32a4857 (patch)
tree17822725886d29c0d44d45e31d3911c32816d992 /llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
parent6d2ea6ec809d7c648c7b31ae195753b5507e7169 (diff)
downloadbcm5719-llvm-48ff66a28098afd7c3bd593adb45a8d8d32a4857.tar.gz
bcm5719-llvm-48ff66a28098afd7c3bd593adb45a8d8d32a4857.zip
Don't return an invalid line table if the DW_AT_stmt_list value is not in the .debug_line section.
llvm-svn: 302180
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFContext.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFContext.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 573d37d77fe..179d6afa579 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -692,6 +692,10 @@ DWARFContext::getLineTableForUnit(DWARFUnit *U) {
if (const DWARFLineTable *lt = Line->getLineTable(stmtOffset))
return lt;
+ // Make sure the offset is good before we try to parse.
+ if (stmtOffset >= U->getLineSection().size())
+ return nullptr;
+
// We have to parse it first.
DataExtractor lineData(U->getLineSection(), isLittleEndian(),
U->getAddressByteSize());
OpenPOWER on IntegriCloud