summaryrefslogtreecommitdiff
path: root/bfd/dwarf2.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-09-24 14:36:48 +0930
committerAlan Modra <amodra@gmail.com>2017-09-24 16:17:19 +0930
commitd8010d3e75ec7194a4703774090b27486b742d48 (patch)
tree05e62718647ce5cad15cb23687e56146d611465a /bfd/dwarf2.c
parent515f23e63c0074ab531bc954f84ca40c6281a724 (diff)
downloadbinutils-gdb-d8010d3e75ec7194a4703774090b27486b742d48.tar.gz
PR22186, divide-by-zero in decode_line_info
PR 22186 * dwarf2.c (decode_line_info): Fail on lh.line_range of zero rather than dividing by zero.
Diffstat (limited to 'bfd/dwarf2.c')
-rw-r--r--bfd/dwarf2.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 89a3f9b1830..8b2281ee86c 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -2437,6 +2437,8 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
case DW_LNS_set_basic_block:
break;
case DW_LNS_const_add_pc:
+ if (lh.line_range == 0)
+ goto line_fail;
if (lh.maximum_ops_per_insn == 1)
address += (lh.minimum_instruction_length
* ((255 - lh.opcode_base) / lh.line_range));