]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
elf: Disallow the empty global symbol name
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 23 Sep 2025 02:05:14 +0000 (10:05 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 23 Sep 2025 20:20:38 +0000 (04:20 +0800)
Reject the empty global symbol name, "".

PR ld/33456
* elflink.c (elf_link_add_object_symbols): Disallow the empty
global symbol name.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
bfd/elflink.c

index b04b017747fb35d1c1b997964913f78b927ca457..66982f82b94a597f2e647497a0ef2045042d2d13 100644 (file)
@@ -5096,6 +5096,13 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
       if (name == NULL)
        goto error_free_vers;
 
+      if (name[0] == '\0')
+       {
+         _bfd_error_handler (_("%pB: corrupt symbol table"), abfd);
+         bfd_set_error (bfd_error_bad_value);
+         goto error_free_vers;
+       }
+
       if (isym->st_shndx == SHN_COMMON
          && (abfd->flags & BFD_PLUGIN) != 0)
        {