diff -rupN --no-dereference binutils-2.41/bfd/elf.c binutils-2.41-new/bfd/elf.c --- binutils-2.41/bfd/elf.c 2023-10-17 08:36:10.773734280 +0200 +++ binutils-2.41-new/bfd/elf.c 2023-10-17 08:36:21.496307731 +0200 @@ -9479,6 +9479,8 @@ _bfd_elf_slurp_version_tables (bfd *abfd if (elf_use_dt_symtab_p (abfd)) iverneed->vn_filename = elf_tdata (abfd)->dt_strtab + iverneed->vn_file; + else if (hdr == NULL) + goto error_return_bad_verref; else iverneed->vn_filename = bfd_elf_string_from_elf_section (abfd, hdr->sh_link, @@ -9516,6 +9518,8 @@ _bfd_elf_slurp_version_tables (bfd *abfd if (elf_use_dt_symtab_p (abfd)) ivernaux->vna_nodename = elf_tdata (abfd)->dt_strtab + ivernaux->vna_name; + else if (hdr == NULL) + goto error_return_bad_verref; else ivernaux->vna_nodename = bfd_elf_string_from_elf_section (abfd, hdr->sh_link, @@ -9546,7 +9550,7 @@ _bfd_elf_slurp_version_tables (bfd *abfd iverneed->vn_nextref = NULL; if (iverneed->vn_next == 0) break; - if (i + 1 < hdr->sh_info) + if (hdr != NULL && (i + 1 < hdr->sh_info)) iverneed->vn_nextref = iverneed + 1; if (iverneed->vn_next