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] Fix a seg-fault when stripping a corrupt binary.


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

commit bcc3a8bca12aa077e6d40880f2d41f05864d4798
Author: Nick Clifton <nickc@redhat.com>
Date:   Thu Jun 2 16:20:27 2016 +0100

    Fix a seg-fault when stripping a corrupt binary.
    
    	PR 20089
    	* objcopy.c (group_signature): Fail if the input symbol table has
    	not been loaded.

Diff:
---
 binutils/ChangeLog | 4 ++++
 binutils/objcopy.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 9dfaf2b..a91b99b 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,9 @@
 2016-06-02  Nick Clifton  <nickc@redhat.com>
 
+	PR 20089
+	* objcopy.c (group_signature): Fail if the input symbol table has
+	not been loaded.
+
 	* dwarf.c (display_debug_frames): Do not display any
 	interpretation if the block consists solely of DW__CFA_NOPs.
 
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 9426761..98332cd 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -1125,6 +1125,10 @@ group_signature (asection *group)
   bfd *abfd = group->owner;
   Elf_Internal_Shdr *ghdr;
 
+  /* PR 20089: An earlier error may have prevented us from loading the symbol table.  */
+  if (isympp == NULL)
+    return NULL;
+
   if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
     return NULL;


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