Skip to content

Commit

Permalink
Don't return an invalid line table if the DW_AT_stmt_list value is no…
Browse files Browse the repository at this point in the history
…t in the .debug_line section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302180 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Greg Clayton committed May 4, 2017
1 parent 984dc04 commit b1cbece
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/DebugInfo/DWARF/DWARFContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit b1cbece

Please sign in to comment.