summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduardo Santiago <[email protected]>2010-05-28 14:26:52 -0700
committerRoland McGrath <[email protected]>2010-05-28 14:26:52 -0700
commitd2240bc4dc850e49062094d78c21c50038f31ccf (patch)
tree979928bb47042ee9070a807984fc48734bc71dd1
parent173ade8794ff3e569738202b20346b15b3f1df2a (diff)
Fix dwarf_getlocation crash on NULL argument.
-rw-r--r--libdw/ChangeLog4
-rw-r--r--libdw/dwarf_getlocation.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 9f876523..41203397 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,7 @@
+2010-05-28 Eduardo Santiago <[email protected]>
+
+ * dwarf_getlocation.c (dwarf_getlocation): Do attr_ok check first thing.
+
2010-05-27 Roland McGrath <[email protected]>
* dwarf.h: Add DW_AT_enum_class, DW_AT_linkage_name,
diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c
index ede8c3c9..c89488b3 100644
--- a/libdw/dwarf_getlocation.c
+++ b/libdw/dwarf_getlocation.c
@@ -541,13 +541,13 @@ dwarf_getlocation (attr, llbuf, listlen)
Dwarf_Op **llbuf;
size_t *listlen;
{
+ if (! attr_ok (attr))
+ return -1;
+
int result = check_constant_offset (attr, llbuf, listlen);
if (result != 1)
return result;
- if (! attr_ok (attr))
- return -1;
-
/* If it has a block form, it's a single location expression. */
Dwarf_Block block;
if (INTUSE(dwarf_formblock) (attr, &block) != 0)