mirror of
https://github.com/intel/llvm.git
synced 2026-01-27 06:06:34 +08:00
[ELF] Prevent crash when reporting errors if debug line cannot be parsed
LLD uses the debug info and debug line sections to determine the location of e.g. references to undefined symbols, when producing error messages. In the event that debug info was present, but debug line parsing failed for some reason, then a nullptr would end up being dereferenced by the location-lookup code. Differential Revision: https://reviews.llvm.org/D44205 Reviewers: grimar llvm-svn: 326899
This commit is contained in:
@@ -126,6 +126,8 @@ template <class ELFT> void ObjFile<ELFT>::initializeDwarf() {
|
||||
// CU (object file), so offset is always 0.
|
||||
const DWARFDebugLine::LineTable *LT =
|
||||
DwarfLine->getOrParseLineTable(LineData, 0, Dwarf, nullptr);
|
||||
if (!LT)
|
||||
return;
|
||||
|
||||
// Return if there is no debug information about CU available.
|
||||
if (!Dwarf.getNumCompileUnits())
|
||||
|
||||
Reference in New Issue
Block a user