summaryrefslogtreecommitdiff
path: root/libdw/dwarf_getaranges.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-01-18 19:59:08 +0000
committerUlrich Drepper <drepper@redhat.com>2008-01-18 19:59:08 +0000
commit35f08c4d52d0ffd9f8aa50f47b84de5603842b1f (patch)
tree7def9d6d4ef3ffea169252d44325cb039294129d /libdw/dwarf_getaranges.c
parent4173bd8d5dd43413ba0635e2a74bc57a9478fb13 (diff)
downloadelfutils-35f08c4d52d0ffd9f8aa50f47b84de5603842b1f.tar.gz
propagate from branch 'com.redhat.elfutils.nickc.pending' (head 28d6423325f0cc14a133eb6b92a8c3604e437ba6)
to branch 'com.redhat.elfutils' (head 6ef48518ed8497626058574c787852bd939d46ee)
Diffstat (limited to 'libdw/dwarf_getaranges.c')
-rw-r--r--libdw/dwarf_getaranges.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libdw/dwarf_getaranges.c b/libdw/dwarf_getaranges.c
index d2294ea3..b6c19425 100644
--- a/libdw/dwarf_getaranges.c
+++ b/libdw/dwarf_getaranges.c
@@ -55,7 +55,7 @@
#include <stdlib.h>
#include <assert.h>
#include "libdwP.h"
-
+#include <dwarf.h>
struct arangelist
{
@@ -131,11 +131,14 @@ dwarf_getaranges (dbg, aranges, naranges)
a segment descriptor on the target system. */
Dwarf_Word length = read_4ubyte_unaligned_inc (dbg, readp);
unsigned int length_bytes = 4;
- if (length == 0xffffffff)
+ if (length == DWARF3_LENGTH_64_BIT)
{
length = read_8ubyte_unaligned_inc (dbg, readp);
length_bytes = 8;
}
+ else if (unlikely (length >= DWARF3_LENGTH_MIN_ESCAPE_CODE
+ && length <= DWARF3_LENGTH_MAX_ESCAPE_CODE))
+ goto invalid;
unsigned int version = read_2ubyte_unaligned_inc (dbg, readp);
if (version != 2)
@@ -197,11 +200,11 @@ dwarf_getaranges (dbg, aranges, naranges)
const char *cu_header = (dbg->sectiondata[IDX_debug_info]->d_buf
+ offset);
unsigned int offset_size;
- if (read_4ubyte_unaligned_noncvt (cu_header) == 0xffffffff)
+ if (read_4ubyte_unaligned_noncvt (cu_header) == DWARF3_LENGTH_64_BIT)
offset_size = 8;
else
offset_size = 4;
- new_arange->arange.offset = offset + 3 * offset_size - 4 + 3;
+ new_arange->arange.offset = DIE_OFFSET_FROM_CU_OFFSET (offset, offset_size);
/* Sanity-check the data. */
if (new_arange->arange.offset