Don't return an invalid line table if the DW_AT_stmt_list value is not in the .debug_...
authorGreg Clayton <gclayton@apple.com>
Thu, 4 May 2017 18:29:44 +0000 (18:29 +0000)
committerGreg Clayton <gclayton@apple.com>
Thu, 4 May 2017 18:29:44 +0000 (18:29 +0000)
llvm-svn: 302180

llvm/lib/DebugInfo/DWARF/DWARFContext.cpp

index 573d37d..179d6af 100644 (file)
@@ -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());