Fix dwarf_getlocation crash on NULL argument.
authorEduardo Santiago <santiago@redhat.com>
Fri, 28 May 2010 21:26:52 +0000 (14:26 -0700)
committerRoland McGrath <roland@redhat.com>
Fri, 28 May 2010 21:26:52 +0000 (14:26 -0700)
libdw/ChangeLog
libdw/dwarf_getlocation.c

index 9f87652..4120339 100644 (file)
@@ -1,3 +1,7 @@
+2010-05-28  Eduardo Santiago  <santiago@redhat.com>
+
+       * dwarf_getlocation.c (dwarf_getlocation): Do attr_ok check first thing.
+
 2010-05-27  Roland McGrath  <roland@redhat.com>
 
        * dwarf.h: Add DW_AT_enum_class, DW_AT_linkage_name,
index ede8c3c..c89488b 100644 (file)
@@ -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)