This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB 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] PR symtab/17890


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

commit cd366ee8c6ca1dfe8aa11540402904b64775b208
Author: Doug Evans <dje@google.com>
Date:   Thu Jan 29 10:26:38 2015 -0800

    PR symtab/17890
    
    gdb/ChangeLog:
    
    	PR symtab/17890
    	* dwarf2read.c (dwarf_decode_line_header): Punt if version > 4.

Diff:
---
 gdb/ChangeLog    |  5 +++++
 gdb/dwarf2read.c | 10 ++++++++++
 2 files changed, 15 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f369364..af5da9b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-29  Doug Evans  <dje@google.com>
+
+	PR symtab/17890
+	* dwarf2read.c (dwarf_decode_line_header): Punt if version > 4.
+
 2015-01-25  Mark Wielaard  <mjw@redhat.com>
 
 	* dwarf2read.c (checkproducer): Call producer_is_gcc.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 89b8dfe..090d1a5 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -17136,6 +17136,8 @@ get_debug_line_section (struct dwarf2_cu *cu)
 /* Read the statement program header starting at OFFSET in
    .debug_line, or .debug_line.dwo.  Return a pointer
    to a struct line_header, allocated using xmalloc.
+   Returns NULL if there is a problem reading the header, e.g., if it
+   has a version we don't understand.
 
    NOTE: the strings in the include directory and file name tables of
    the returned object point into the dwarf line section buffer,
@@ -17200,6 +17202,14 @@ dwarf_decode_line_header (unsigned int offset, struct dwarf2_cu *cu)
   lh->statement_program_end = line_ptr + lh->total_length;
   lh->version = read_2_bytes (abfd, line_ptr);
   line_ptr += 2;
+  if (lh->version > 4)
+    {
+      /* This is a version we don't understand.  The format could have
+	 changed in ways we don't handle properly so just punt.  */
+      complaint (&symfile_complaints,
+		 _("unsupported version in .debug_line section"));
+      return NULL;
+    }
   lh->header_length = read_offset_1 (abfd, line_ptr, offset_size);
   line_ptr += offset_size;
   lh->minimum_instruction_length = read_1_byte (abfd, line_ptr);


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