[binutils-gdb] PR25637, objcopy : SIGSEGV in copy_object

Alan Modra amodra@sourceware.org
Fri Mar 6 00:06:00 GMT 2020


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

commit a9b90127e864d0cac1b7b803cb2af4eab01dbdab
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Mar 6 10:33:10 2020 +1030

    PR25637, objcopy : SIGSEGV in copy_object
    
    	PR 25637
    	* objcopy.c (filter_symbols): Correct rem_leading_char logic.

Diff:
---
 binutils/ChangeLog |  5 +++++
 binutils/objcopy.c | 13 +++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 7ce0326..1fe7f15 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2020-03-06  Alan Modra  <amodra@gmail.com>
+
+	PR 25637
+	* objcopy.c (filter_symbols): Correct rem_leading_char logic.
+
 2020-03-05  Alan Modra  <amodra@gmail.com>
 
 	PR 25629
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 3b9f1b7..16affa9 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -1549,12 +1549,13 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
 
       /* Check if we will remove the current leading character.  */
       rem_leading_char =
-	(name[0] == bfd_get_symbol_leading_char (abfd))
-	&& (change_leading_char
-	    || (remove_leading_char
-		&& ((flags & (BSF_GLOBAL | BSF_WEAK)) != 0
-		    || undefined
-		    || bfd_is_com_section (bfd_asymbol_section (sym)))));
+	(name[0] != '\0'
+	 && name[0] == bfd_get_symbol_leading_char (abfd)
+	 && (change_leading_char
+	     || (remove_leading_char
+		 && ((flags & (BSF_GLOBAL | BSF_WEAK)) != 0
+		     || undefined
+		     || bfd_is_com_section (bfd_asymbol_section (sym))))));
 
       /* Check if we will add a new leading character.  */
       add_leading_char =



More information about the Binutils-cvs mailing list