This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] PR22186, divide-by-zero in decode_line_info


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d8010d3e75ec7194a4703774090b27486b742d48

commit d8010d3e75ec7194a4703774090b27486b742d48
Author: Alan Modra <amodra@gmail.com>
Date:   Sun Sep 24 14:36:48 2017 +0930

    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.

Diff:
---
 bfd/ChangeLog | 6 ++++++
 bfd/dwarf2.c  | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f63a8bb..e232764 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
 2017-09-24  Alan Modra  <amodra@gmail.com>
 
+	PR 22186
+	* dwarf2.c (decode_line_info): Fail on lh.line_range of zero
+	rather than dividing by zero.
+
+2017-09-24  Alan Modra  <amodra@gmail.com>
+
 	PR 22169
 	* dwarf2.c (decode_line_info): Correct .debug_line unit_length check.
 
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 89a3f9b..8b2281e 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));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]