]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix a NULL pointer dereference in nm, when parsing a corrupt file.
authorNick Clifton <nickc@redhat.com>
Mon, 11 Feb 2019 16:15:59 +0000 (16:15 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 11 Feb 2019 16:15:59 +0000 (16:15 +0000)
PR 24168
* nm.c (print_symbol): Check for NULL contents of the sym_ptr_ptr
field.

binutils/ChangeLog
binutils/nm.c

index 0eba8440e8b71e50f3080b2531f1f9c061fbb8ca..ad4f226edf47b7dbcc7835e8d436f172c8c15027 100644 (file)
@@ -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
index e46fffc796f772141e9ad8ea4515be2dc36d49cd..afaea56714b12e727bbcb218c0f1e79bc6faaf19 100644 (file)
@@ -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,