From b1cbece4122eff558f363bcaec48e5ee2ec326da Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Thu, 4 May 2017 18:29:44 +0000 Subject: [PATCH] Don't return an invalid line table if the DW_AT_stmt_list value is not in the .debug_line section. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302180 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/DebugInfo/DWARF/DWARFContext.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/DebugInfo/DWARF/DWARFContext.cpp b/lib/DebugInfo/DWARF/DWARFContext.cpp index 573d37d77fe..179d6afa579 100644 --- a/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/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()); -- 2.40.0