PR25637, objcopy : SIGSEGV in copy_object
authorAlan Modra <amodra@gmail.com>
Fri, 6 Mar 2020 00:03:10 +0000 (10:33 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 6 Mar 2020 00:04:19 +0000 (10:34 +1030)
PR 25637
* objcopy.c (filter_symbols): Correct rem_leading_char logic.

binutils/ChangeLog
binutils/objcopy.c

index 7ce0326ac49b5269f711446b6c54dcf328d9848c..1fe7f15419284cdaf6ee1fc9e83b5bd7061d0faa 100644 (file)
@@ -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
index 3b9f1b73ca90b52d46091a39856ecf8e9a65bb57..16affa9960fafc0822c3adac559b50c89282ba39 100644 (file)
@@ -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 =