[DebugInfo] Avoid crashing when parsing an invalid unit header in DWP.
authorIgor Kudrin <ikudrin@accesssoftek.com>
Wed, 26 Feb 2020 14:23:43 +0000 (21:23 +0700)
committerIgor Kudrin <ikudrin@accesssoftek.com>
Fri, 28 Feb 2020 08:35:51 +0000 (15:35 +0700)
commit044308e9ed5cb69076eca7156a694f4d2844cf74
tree933a82974a0f46fa1c817587119240df88761446
parent5754a61e57efaa9bec8ad8ea8589a73b27edb0a8
[DebugInfo] Avoid crashing when parsing an invalid unit header in DWP.

The integrity checks for index entries in DWARFUnitHeader::extract()
might cause the function to return before checking the state of an
Error object, which leads to a crash in runtime. The patch fixes the
issue by moving the checks in a safe place.

Differential Revision: https://reviews.llvm.org/D75177
llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
llvm/test/DebugInfo/X86/invalid-cu-length-dwp.s [new file with mode: 0644]