===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.496
@@ -5863,10 +5863,22 @@ dwarf2_ranges_read (unsigned offset, COR
return 0;
}
+ if (range_beginning > range_end)
+ {
+ /* Inverted range entries are invalid. */
+ complaint (&symfile_complaints,
+ _("Invalid .debug_ranges data (inverted range)"));
+ return 0;
+ }
+
+ /* Empty range entries have no effect. */
+ if (range_beginning == range_end)
+ continue;
+
range_beginning += base;
range_end += base;
- if (ranges_pst != NULL && range_beginning < range_end)
+ if (ranges_pst != NULL)
addrmap_set_empty (objfile->psymtabs_addrmap,
range_beginning + baseaddr,
range_end - 1 + baseaddr,
@@ -6149,6 +6161,19 @@ dwarf2_record_block_ranges (struct die_i
return;
}
+ if (start > end)
+ {
+ /* Inverted range entries are invalid. */
+ complaint (&symfile_complaints,
+ _("Invalid .debug_ranges data "
+ "(inverted range)"));
+ return;
+ }
+
+ /* Empty range entries have no effect. */
+ if (start == end)
+ continue;
+
record_block_range (block,
baseaddr + base + start,
baseaddr + base + end - 1);