public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [commit] dwarf2read.c: ignore bad address ranges in .gdb_index
@ 2013-08-09 17:29 Doug Evans
  0 siblings, 0 replies; 2+ messages in thread
From: Doug Evans @ 2013-08-09 17:29 UTC (permalink / raw)
  To: gdb-patches

Hi.

I was seeing some bad address ranges in .gdb_index generated by Gold.

Regression tested on amd64-linux and committed.

2013-08-09  Doug Evans  <dje@google.com>

	* dwarf2read.c (create_addrmap_from_index): Ignore bad address table
	entries.

diff -u -p -r1.824 dwarf2read.c
--- dwarf2read.c	7 Aug 2013 20:10:36 -0000	1.824
+++ dwarf2read.c	9 Aug 2013 17:26:09 -0000
@@ -2570,17 +2570,24 @@ create_addrmap_from_index (struct objfil
       cu_index = extract_unsigned_integer (iter, 4, BFD_ENDIAN_LITTLE);
       iter += 4;
 
-      if (cu_index < dwarf2_per_objfile->n_comp_units)
+      if (lo > hi)
 	{
-	  addrmap_set_empty (mutable_map, lo + baseaddr, hi + baseaddr - 1,
-			     dw2_get_cu (cu_index));
+	  complaint (&symfile_complaints,
+		     _(".gdb_index address table has invalid range (%s - %s)"),
+		     pulongest (lo), pulongest (hi));
+	  continue;
 	}
-      else
+
+      if (cu_index >= dwarf2_per_objfile->n_comp_units)
 	{
 	  complaint (&symfile_complaints,
 		     _(".gdb_index address table has invalid CU number %u"),
 		     (unsigned) cu_index);
+	  continue;
 	}
+
+      addrmap_set_empty (mutable_map, lo + baseaddr, hi + baseaddr - 1,
+			 dw2_get_cu (cu_index));
     }
 
   objfile->psymtabs_addrmap = addrmap_create_fixed (mutable_map,

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [commit] dwarf2read.c: ignore bad address ranges in .gdb_index
@ 2013-08-09 17:41 Doug Evans
  0 siblings, 0 replies; 2+ messages in thread
From: Doug Evans @ 2013-08-09 17:41 UTC (permalink / raw)
  To: gdb-patches

I wrote:
> Hi.
> 
> I was seeing some bad address ranges in .gdb_index generated by Gold.
> 
> Regression tested on amd64-linux and committed.
> 
> 2013-08-09  Doug Evans  <dje@google.com>
> 
>	* dwarf2read.c (create_addrmap_from_index): Ignore bad address table
> 	entries.

Blech.  Committed as well.

diff -u -p -r1.825 dwarf2read.c
--- dwarf2read.c	9 Aug 2013 17:26:40 -0000	1.825
+++ dwarf2read.c	9 Aug 2013 17:35:09 -0000
@@ -2574,7 +2574,7 @@ create_addrmap_from_index (struct objfil
 	{
 	  complaint (&symfile_complaints,
 		     _(".gdb_index address table has invalid range (%s - %s)"),
-		     pulongest (lo), pulongest (hi));
+		     hex_string (lo), hex_string (hi));
 	  continue;
 	}
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-09 17:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-09 17:29 [commit] dwarf2read.c: ignore bad address ranges in .gdb_index Doug Evans
2013-08-09 17:41 Doug Evans

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).