Author: emaste
Date: Wed Feb 25 22:12:37 2015
New Revision: 279301
URL: https://svnweb.freebsd.org/changeset/base/279301

Log:
  GNU nm: Avoid NULL dereference
  
  bfd_dwarf2_find_line() calls find_line() with NULL functionname_ptr,
  which resulted in a crash on certain ELF objects.
  
  This change was implemented independently from upstream binutils, but
  I have checked that the crash does not happen there.
  
  MFC after:    1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/binutils/bfd/dwarf2.c

Modified: head/contrib/binutils/bfd/dwarf2.c
==============================================================================
--- head/contrib/binutils/bfd/dwarf2.c  Wed Feb 25 21:59:03 2015        
(r279300)
+++ head/contrib/binutils/bfd/dwarf2.c  Wed Feb 25 22:12:37 2015        
(r279301)
@@ -2382,7 +2382,8 @@ find_line (bfd *abfd,
   else
     addr += section->vma;
   *filename_ptr = NULL;
-  *functionname_ptr = NULL;
+  if (!do_line)
+    *functionname_ptr = NULL;
   *linenumber_ptr = 0;
 
   if (! *pinfo)
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to