[llvm] r302180 - Don't return an invalid line table if the DW_AT_stmt_list value is not in the .debug_line section.

Greg Clayton via llvm-commits llvm-commits at lists.llvm.org
Thu May 4 11:29:45 PDT 2017


Author: gclayton
Date: Thu May  4 13:29:44 2017
New Revision: 302180

URL: http://llvm.org/viewvc/llvm-project?rev=302180&view=rev
Log:
Don't return an invalid line table if the DW_AT_stmt_list value is not in the .debug_line section.


Modified:
    llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp?rev=302180&r1=302179&r2=302180&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp Thu May  4 13:29:44 2017
@@ -692,6 +692,10 @@ DWARFContext::getLineTableForUnit(DWARFU
   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());




More information about the llvm-commits mailing list