summaryrefslogtreecommitdiff
path: root/backends/sparc_retval.c
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2013-02-06 13:15:10 +0100
committerMark Wielaard <mjw@redhat.com>2013-02-06 23:27:03 +0100
commit1d5037f725b691929396896fd2b6be3cae1d87ef (patch)
treeefa4f61691eb0d74b6dae5ceb4b3901282420741 /backends/sparc_retval.c
parent6c4b2078c51c687a1a192b001f0b331a0ccac629 (diff)
downloadelfutils-1d5037f725b691929396896fd2b6be3cae1d87ef.tar.gz
backends: Check type DIE exists before calling dwarf_tag ().
dwarf_attr () or dwarf_form () functions leave typedie NULL when they fail because of missing attribute or unexpected form. In such cases first check the DIE exists and return error instead of calling dwarf_tag () and crashing. This also happens in the testsuite with native tests when elfutils is build without DWZ support on a distro that uses DWZ DWARF compression on system libraries. Only the backends used dwarf_tag () directly without checking, all other uses in elfutils already checked whether the given DIE was NULL. Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'backends/sparc_retval.c')
-rw-r--r--backends/sparc_retval.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/backends/sparc_retval.c b/backends/sparc_retval.c
index 2c2728c6..dcd37859 100644
--- a/backends/sparc_retval.c
+++ b/backends/sparc_retval.c
@@ -82,7 +82,7 @@ sparc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
Dwarf_Die die_mem;
Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem);
- int tag = dwarf_tag (typedie);
+ int tag = DWARF_TAG_OR_RETURN (typedie);
/* Follow typedefs and qualifiers to get to the actual type. */
while (tag == DW_TAG_typedef
@@ -91,7 +91,7 @@ sparc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
{
attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
typedie = dwarf_formref_die (attr, &die_mem);
- tag = dwarf_tag (typedie);
+ tag = DWARF_TAG_OR_RETURN (typedie);
}
Dwarf_Word size;
@@ -105,7 +105,7 @@ sparc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
{
attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
typedie = dwarf_formref_die (attr, &die_mem);
- tag = dwarf_tag (typedie);
+ tag = DWARF_TAG_OR_RETURN (typedie);
}
/* Fall through. */