summaryrefslogtreecommitdiffstats
path: root/libdw/dwarf_formudata.c
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2009-07-16 17:48:27 -0700
committerRoland McGrath <[email protected]>2009-07-16 17:48:27 -0700
commite160cc9336250462058014cbbbef07a086bbeced (patch)
tree56a8e43ccf2c50736a8d5fc4cff86e62bacd098d /libdw/dwarf_formudata.c
parenta6abdfd9733842d3b0a23eb2e0619b0109358e3b (diff)
Support the easiest of the new v4 form flavors.
Diffstat (limited to 'libdw/dwarf_formudata.c')
-rw-r--r--libdw/dwarf_formudata.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libdw/dwarf_formudata.c b/libdw/dwarf_formudata.c
index 04f04aae..d9d0a1cd 100644
--- a/libdw/dwarf_formudata.c
+++ b/libdw/dwarf_formudata.c
@@ -1,5 +1,5 @@
/* Return unsigned constant represented by attribute.
- Copyright (C) 2003, 2005 Red Hat, Inc.
+ Copyright (C) 2003-2009 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <[email protected]>, 2003.
@@ -71,6 +71,15 @@ __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
}
Dwarf_Word offset;
+ if (attr->form == DW_FORM_sec_offset)
+ {
+ if (__libdw_read_offset (attr->cu->dbg, IDX_debug_info, attr->valp,
+ attr->cu->offset_size, &offset, sec_index, 0))
+ return NULL;
+ }
+ else if (attr->cu->version > 3)
+ goto invalid;
+
switch (attr->form)
{
case DW_FORM_data4:
@@ -90,6 +99,7 @@ __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
unsigned char *endp = d->d_buf + d->d_size;
if (unlikely (readp >= endp))
{
+ invalid:
__libdw_seterrno (DWARF_E_INVALID_DWARF);
return NULL;
}