public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-tromey-delayed-symfile:  * dwarf2read.c (dwarf2_create_quick_addrmap): Sanity-check aranges  section.
@ 2009-08-13 19:53 tromey
  0 siblings, 0 replies; only message in thread
From: tromey @ 2009-08-13 19:53 UTC (permalink / raw)
  To: archer-commits

The branch, archer-tromey-delayed-symfile has been updated
       via  d0fe3272b8b3b64a9a72912d334a9adca8c66a99 (commit)
      from  d73baf081a4ad1760a1e08f70705b9e6dce96420 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit d0fe3272b8b3b64a9a72912d334a9adca8c66a99
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Aug 13 13:52:26 2009 -0600

    	* dwarf2read.c (dwarf2_create_quick_addrmap): Sanity-check aranges
    	section.

-----------------------------------------------------------------------

Summary of changes:
 gdb/dwarf2read.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

First 500 lines of diff:
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 69328f4..2272259 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1421,9 +1421,21 @@ dwarf2_create_quick_addrmap (struct objfile *objfile)
       unsigned int bytes_read, segment_size, delta;
       LONGEST info_offset;
       struct dwarf2_cu cu;
+      char *end_ptr;
 
       cu_header.initial_length_size = 0;
+      end_ptr = aranges_ptr;
       aranges_ptr = read_comp_unit_head (&cu_header, aranges_ptr, abfd);
+      end_ptr += cu_header.initial_length_size + cu_header.length;
+
+      /* Sanity check.  */
+      if (end_ptr - aranges_ptr >= dwarf2_per_objfile->aranges.size)
+	{
+	  do_cleanups (old);
+	  complaint (&symfile_complaints,
+		     _("aranges entry runs off end of `.debug_aranges' section, ignored"));
+	  return;
+	}
 
       segment_size = read_1_byte (abfd, aranges_ptr);
       aranges_ptr += 1;
@@ -1454,6 +1466,18 @@ dwarf2_create_quick_addrmap (struct objfile *objfile)
 
 	  addrmap_set_empty (mutable_map, address, address + length, objfile);
 	}
+
+      /* Some older versions of GCC incorrectly started the arange
+	 with a (0,0) pair.  If we encounter any oddity while reading
+	 the section, just abandon the attempt; falling back to the
+	 slower code is always safe.  */
+      if (aranges_ptr != end_ptr)
+	{
+	  do_cleanups (old);
+	  complaint (&symfile_complaints,
+		     _("aranges entry ends early, ignored"));
+	  return;
+	}
     }
 
   objfile->quick_addrmap = addrmap_create_fixed (mutable_map,


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-08-13 19:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-13 19:53 [SCM] archer-tromey-delayed-symfile: * dwarf2read.c (dwarf2_create_quick_addrmap): Sanity-check aranges section tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).