[DebugInfo] Add check for zero debug line opcode_base
authorJames Henderson <james.henderson@sony.com>
Tue, 11 Feb 2020 12:17:33 +0000 (12:17 +0000)
committerJames Henderson <james.henderson@sony.com>
Wed, 12 Feb 2020 14:49:22 +0000 (14:49 +0000)
commit23cf0a30b1528cf268ffdf13e04a5baa7eddfe0a
treeb1962f58353404255f57968d9228fa0c45b2f8cc
parent1da62b51a5f00a4b84843f3ecc8a495de618afc8
[DebugInfo] Add check for zero debug line opcode_base

The number of standard opcodes is defined to be opcode_base - 1, so a
value of 0 for the opcode_base caused a crash as an attempt was made to
reserve many entries in a vector. This change fixes the crash, by
issuing a warning and skipping reading of standard opcode lengths in the
event of an opcode_base of 0.

Reviewed by: dblaikie

Differential Revision: https://reviews.llvm.org/D74309
llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
llvm/test/tools/llvm-dwarfdump/X86/Inputs/debug_line_malformed.s
llvm/test/tools/llvm-dwarfdump/X86/debug_line_invalid.test