[DebugInfo] Fix a possible crash when reading a malformed .debug_*lists section.
authorIgor Kudrin <ikudrin@accesssoftek.com>
Tue, 14 Jul 2020 08:55:31 +0000 (15:55 +0700)
committerIgor Kudrin <ikudrin@accesssoftek.com>
Tue, 14 Jul 2020 09:35:17 +0000 (16:35 +0700)
commitec9f0c7d4ae257642ee825baa9e23f9ffb000de8
tree0c0c3b8ee5f703dd9ee20a958031733ed9df7ca2
parentdd6faf13d8e27990f226147f543a6bdf1d0a0c46
[DebugInfo] Fix a possible crash when reading a malformed .debug_*lists section.

DWARFListTableHeader::length() handles the zero value of HeaderData.Length
in a special way, which makes the result different from the calculated
value of FullLength, which leads to triggering an assertion. The patch
moves the assertion a bit later when `FullLength` is already checked for
minimal allowed value.

Differential Revision: https://reviews.llvm.org/D82886
llvm/lib/DebugInfo/DWARF/DWARFListTable.cpp
llvm/test/DebugInfo/X86/dwarfdump-rnglists-zero-length.s [new file with mode: 0644]