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
This commit is contained in:
Greg Clayton 2017-05-04 18:29:44 +00:00
parent 984dc047e7
commit b1cbece412

View 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());