aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2011-02-04 18:13:25 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2011-02-04 18:13:25 +0000
commit9277c30c29f32ebee42e9e390a08bfac64d1ee67 (patch)
tree058797faa37295f215618525329c3fd3b7b9ccc9 /gdb
parenta3be78903d86658beeac7227bc76cae9f05c0cac (diff)
downloadgdb-9277c30c29f32ebee42e9e390a08bfac64d1ee67.zip
gdb-9277c30c29f32ebee42e9e390a08bfac64d1ee67.tar.gz
gdb-9277c30c29f32ebee42e9e390a08bfac64d1ee67.tar.bz2
* dwarf2read.c (dwarf2_ranges_read): Skip empty range entries.
Complain about inverted range entries. (dwarf2_record_block_ranges): Likewise.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/dwarf2read.c27
2 files changed, 32 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 95ab563..9622483 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2011-02-04 Ulrich Weigand <ulrich.weigand@linaro.org>
+
+ * dwarf2read.c (dwarf2_ranges_read): Skip empty range entries.
+ Complain about inverted range entries.
+ (dwarf2_record_block_ranges): Likewise.
+
2011-02-04 Thiago Jung Bauermann <bauerman@br.ibm.com>
Fix some typos.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 6a98d57..bc43bd8 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -5863,10 +5863,22 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
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_info *die, struct block *block,
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);