diff options
| author | H.J. Lu <hjl.tools@gmail.com> | 2025-09-30 08:50:19 +0800 |
|---|---|---|
| committer | H.J. Lu <hjl.tools@gmail.com> | 2025-10-03 05:32:18 +0800 |
| commit | bf7c1b207d84707b8bb99fb57122e3e58d3065fe (patch) | |
| tree | cb96c6a2505c81b06cd5fcd31c06f361ac951708 | |
| parent | 4cb845ee59587c80bb641209ea109a4a0557f542 (diff) | |
| download | binutils-bf7c1b207d84707b8bb99fb57122e3e58d3065fe.zip binutils-bf7c1b207d84707b8bb99fb57122e3e58d3065fe.tar.gz binutils-bf7c1b207d84707b8bb99fb57122e3e58d3065fe.tar.bz2 | |
x86: Check invalid symbol name
Since bfd_elf_sym_name returns bfd_symbol_error_name for invalid symbol,
name, return error if bfd_elf_sym_name returns bfd_symbol_error_name.
PR ld/33501
* elf32-i386.c (elf_i386_scan_relocs): Return error for invalid
symbol name.
* elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
| -rw-r--r-- | bfd/elf32-i386.c | 2 | ||||
| -rw-r--r-- | bfd/elf64-x86-64.c | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index e375e18..507a076 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1607,6 +1607,8 @@ elf_i386_scan_relocs (bfd *abfd, /* Fake a STT_GNU_IFUNC symbol. */ h->root.root.string = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL); + if (h->root.root.string == bfd_symbol_error_name) + goto error_return; h->type = STT_GNU_IFUNC; h->def_regular = 1; h->ref_regular = 1; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 236cff9..620b6a3 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -2590,6 +2590,9 @@ elf_x86_64_scan_relocs (bfd *abfd, struct bfd_link_info *info, /* Fake a STT_GNU_IFUNC symbol. */ h->root.root.string = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL); + if (h->root.root.string == bfd_symbol_error_name) + goto error_return; + h->type = STT_GNU_IFUNC; h->def_regular = 1; h->ref_regular = 1; |
