Don't return an invalid line table if the DW_AT_stmt_list value is not in the .debug_line section.

llvm-svn: 302180
This commit is contained in:
Greg Clayton 2017-05-04 18:29:44 +00:00
parent 6d2ea6ec80
commit 48ff66a280
1 changed files with 4 additions and 0 deletions

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