PR 21409, segfault in _bfd_dwarf2_find_nearest_line
authorAlan Modra <amodra@gmail.com>
Sun, 23 Apr 2017 04:25:49 +0000 (13:55 +0930)
committerAlan Modra <amodra@gmail.com>
Sun, 23 Apr 2017 11:03:13 +0000 (20:33 +0930)
PR 21409
* dwarf2.c (_bfd_dwarf2_find_nearest_line): Don't segfault when
no symbols.

bfd/ChangeLog
bfd/dwarf2.c

index ba2d13474d381c6ec29b9248230c8054520fcaf8..7a389b11e55b19205e9d12104ee0f1574ae95ef8 100644 (file)
@@ -1,3 +1,9 @@
+2017-04-23  Alan Modra  <amodra@gmail.com>
+
+       PR 21409
+       * dwarf2.c (_bfd_dwarf2_find_nearest_line): Don't segfault when
+       no symbols.
+
 2017-04-21  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/21402
index 132a67492a44788bb52fd0c8d82f3012d43f07d1..0ef3e1fc534252c41d6806c40c3b07902b5f3b5b 100644 (file)
@@ -4205,7 +4205,7 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
          looking up the function by section + offset uses the
          DW_AT_decl_line from the function DW_TAG_subprogram for the line,
          which will be the line of the function name.  */
-      if ((section->flags & SEC_CODE) == 0)
+      if (symbols != NULL && (section->flags & SEC_CODE) == 0)
        {
          asymbol **tmp;