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/binutils-2_30-branch] Fix a NULL pointer dereference in nm, when parsing a corrupt file.


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

commit c6f021093dbd26b4d8e761e9a19af817e9f2561f
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Feb 11 16:15:59 2019 +0000

    Fix a NULL pointer dereference in nm, when parsing a corrupt file.
    
    	PR 24168
    	* nm.c (print_symbol): Check for NULL contents of the sym_ptr_ptr
    	field.

Diff:
---
 binutils/ChangeLog | 6 ++++++
 binutils/nm.c      | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 0eba844..ad4f226 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2019-02-11  Nick Clifton  <nickc@redhat.com>
+
+	PR 24168
+	* nm.c (print_symbol): Check for NULL contents of the sym_ptr_ptr
+	field.
+
 2018-03-19  H.J. Lu  <hongjiu.lu@intel.com>
 
 	Backport from master branch
diff --git a/binutils/nm.c b/binutils/nm.c
index e46fffc..afaea56 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -976,6 +976,7 @@ print_symbol (bfd *        abfd,
 	    }
 
 	  symname = bfd_asymbol_name (sym);
+
 	  for (i = 0; i < seccount; i++)
 	    {
 	      long j;
@@ -985,7 +986,9 @@ print_symbol (bfd *        abfd,
 		  arelent *r;
 
 		  r = relocs[i][j];
+
 		  if (r->sym_ptr_ptr != NULL
+		      && * r->sym_ptr_ptr != NULL
 		      && (*r->sym_ptr_ptr)->section == sym->section
 		      && (*r->sym_ptr_ptr)->value == sym->value
 		      && strcmp (symname,


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