[ELF] Prevent crash when reporting errors if debug line cannot be parsed
authorJames Henderson <jh7370@my.bristol.ac.uk>
Wed, 7 Mar 2018 15:22:58 +0000 (15:22 +0000)
committerJames Henderson <jh7370@my.bristol.ac.uk>
Wed, 7 Mar 2018 15:22:58 +0000 (15:22 +0000)
commitcb4c19f3157b02e6d0169949626767f9051c76b6
treeba033439a4d37013497eabb0eee555b41bca6868
parentcb9e89c39b07efa6ba0dfbd24fc1b3d63d564d7f
[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
lld/ELF/InputFiles.cpp
lld/test/ELF/Inputs/undef-bad-debug.s [new file with mode: 0644]
lld/test/ELF/undef.s