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] PR22204, Lack of DW_LNE_end_sequence causes "infinite" loop


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

commit e338894dc2e603683bed2172e8e9f25b29051005
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Sep 26 09:32:18 2017 +0930

    PR22204, Lack of DW_LNE_end_sequence causes "infinite" loop
    
    	PR 22204
    	* dwarf2.c (decode_line_info): Ensure line_ptr stays within
    	bounds in inner loop.

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

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 54199ad..5c4cc2b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2017-09-26  Alan Modra  <amodra@gmail.com>
+
+	PR 22204
+	* dwarf2.c (decode_line_info): Ensure line_ptr stays within
+	bounds in inner loop.
+
 2017-09-25  Alan Modra  <amodra@gmail.com>
 
 	PR 22202
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 9ae5fba..2c45790 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -2277,7 +2277,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
       bfd_vma high_pc = 0;
 
       /* Decode the table.  */
-      while (! end_sequence)
+      while (!end_sequence && line_ptr < line_end)
 	{
 	  op_code = read_1_byte (abfd, line_ptr, line_end);
 	  line_ptr += 1;


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