Fix seg-fault running strip on a corrupt binary.
authorNick Clifton <nickc@redhat.com>
Tue, 6 Dec 2016 16:26:42 +0000 (16:26 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 6 Dec 2016 16:26:42 +0000 (16:26 +0000)
PR binutils/20930
* objcopy.c (mark_symbols_used_in_relocations): Check for a null
symbol pointer pointer before attempting to mark the symbol as
kept.

binutils/ChangeLog
binutils/objcopy.c

index fdbb0564c09fb1deae9578ee1f7ec7b7074938a5..b3429f7989cc410acc576b7d6ac83dcc37d3b579 100644 (file)
@@ -1,3 +1,10 @@
+2016-12-06  Nick Clifton  <nickc@redhat.com>
+
+       PR binutils/20930
+       * objcopy.c (mark_symbols_used_in_relocations): Check for a null
+       symbol pointer pointer before attempting to mark the symbol as
+       kept.
+
 2016-12-05  Jose E. Marchesi  <jose.marchesi@oracle.com>
 
        * MAINTAINERS: Add myself as maintainer for the SPARC targets.
index 6a398ce4dcafba2b1f073d7db32e2b496403674f..c78001204dae606b462bff1c2dd440ba03048c69 100644 (file)
@@ -3551,8 +3551,9 @@ mark_symbols_used_in_relocations (bfd *ibfd, sec_ptr isection, void *symbolsarg)
      special bfd section symbols, then mark it with BSF_KEEP.  */
   for (i = 0; i < relcount; i++)
     {
-      /* See PR 20923 for a reproducer for the NULL test.  */
+      /* See PRs 20923 and 20930 for reproducers for the NULL tests.  */
       if (relpp[i]->sym_ptr_ptr != NULL
+         && * relpp[i]->sym_ptr_ptr != NULL
          && *relpp[i]->sym_ptr_ptr != bfd_com_section_ptr->symbol
          && *relpp[i]->sym_ptr_ptr != bfd_abs_section_ptr->symbol
          && *relpp[i]->sym_ptr_ptr != bfd_und_section_ptr->symbol)