From: Alan Modra Date: Fri, 15 Mar 2019 06:19:59 +0000 (+1030) Subject: PR24339, segfault on NULL symbol section X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fe3fef62ad11115fc3b03c0c0dcb9c38b2f544cb;p=binutils-gdb.git PR24339, segfault on NULL symbol section PR 24339 * elflink.c (elf_link_add_object_symbols): Bail out on a local symbol after globals if elf_bad_symtab is not set. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index eacd828d7e3..b044fad208f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2019-03-15 Alan Modra + + PR 24339 + * elflink.c (elf_link_add_object_symbols): Bail out on a local + symbol after globals if elf_bad_symtab is not set. + 2019-03-15 Alan Modra PR 24337 diff --git a/bfd/elflink.c b/bfd/elflink.c index 2600c3934b1..09990a438f6 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -4442,7 +4442,13 @@ error_free_dyn: global symbols follow all local symbols, and that sh_info point to the first global symbol. Unfortunately, Irix 5 screws this up. */ - continue; + if (elf_bad_symtab (abfd)) + continue; + + /* If we aren't prepared to handle locals within the globals + then we'll likely segfault on a NULL section. */ + bfd_set_error (bfd_error_bad_value); + goto error_free_vers; case STB_GLOBAL: if (isym->st_shndx != SHN_UNDEF && !common)