This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] PR 21409, segfault in _bfd_dwarf2_find_nearest_line


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=97e83a100aa8250be783304bfe0429761c6e6b6b

commit 97e83a100aa8250be783304bfe0429761c6e6b6b
Author: Alan Modra <amodra@gmail.com>
Date:   Sun Apr 23 13:55:49 2017 +0930

    PR 21409, segfault in _bfd_dwarf2_find_nearest_line
    
    	PR 21409
    	* dwarf2.c (_bfd_dwarf2_find_nearest_line): Don't segfault when
    	no symbols.

Diff:
---
 bfd/ChangeLog | 6 ++++++
 bfd/dwarf2.c  | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ba2d134..7a389b1 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 132a674..0ef3e1f 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]