diff options
author | Kevin Buettner <kevinb@redhat.com> | 2003-09-15 17:19:23 +0000 |
---|---|---|
committer | Kevin Buettner <kevinb@redhat.com> | 2003-09-15 17:19:23 +0000 |
commit | 8f22f42df66edcd494e2ef33e9810e6e818d18df (patch) | |
tree | f7432792c26b6776020331cb9bd397c3f4d551a6 | |
parent | 7c42cca171672e04bd80f0392199a1812205bf4a (diff) | |
download | gdb-8f22f42df66edcd494e2ef33e9810e6e818d18df.tar.gz |
* dwarf2read.c (dwarf2_get_pc_bounds): Complain if offset
associated with DW_AT_ranges attribute is out of bounds.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 10 |
2 files changed, 14 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 49e1dff0b95..0e22b0f0283 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2003-09-15 Kevin Buettner <kevinb@redhat.com> + + * dwarf2read.c (dwarf2_get_pc_bounds): Complain if offset + associated with DW_AT_ranges attribute is out of bounds. + 2003-09-15 David Lecomber <dsl@sources.redhat.com> * f-valprint.c: Apply array element printing limits to multi-dimensional arrays diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 75d81e9726b..5f0ec27036b 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2314,7 +2314,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, unsigned int addr_size = cu_header->addr_size; CORE_ADDR mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1)); /* Value of the DW_AT_ranges attribute is the offset in the - .debug_renges section. */ + .debug_ranges section. */ unsigned int offset = DW_UNSND (attr); /* Base address selection entry. */ CORE_ADDR base; @@ -2327,6 +2327,14 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, found_base = cu_header->base_known; base = cu_header->base_address; + + if (offset >= dwarf_ranges_size) + { + complaint (&symfile_complaints, + "Offset %d out of bounds for DW_AT_ranges attribute", + offset); + return 0; + } buffer = dwarf_ranges_buffer + offset; /* Read in the largest possible address. */ |