From: Alan Modra Date: Wed, 28 May 2025 00:14:26 +0000 (+0930) Subject: PR 33018 segv in elf_x86_64_scan_relocs X-Git-Tag: binutils-2_45~478 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=04395ea00492a63a586459acd834af8ab1a02546;p=thirdparty%2Fbinutils-gdb.git PR 33018 segv in elf_x86_64_scan_relocs * elf64-x86-64.c (elf_x86_64_scan_relocs): Error on NULL howto. Use bfd_reloc_offset_in_range. --- diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 1e08f2e7125..8a36eef9c7d 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -2552,7 +2552,13 @@ elf_x86_64_scan_relocs (bfd *abfd, struct bfd_link_info *info, } howto = elf_x86_64_rtype_to_howto (abfd, r_type); - if (rel->r_offset + bfd_get_reloc_size (howto) > sec->size) + if (howto == NULL) + { + _bfd_error_handler (_("%pB: unsupported relocation type %#x"), + abfd, r_type); + goto error_return; + } + if (!bfd_reloc_offset_in_range (howto, abfd, sec, rel->r_offset)) { /* xgettext:c-format */ _bfd_error_handler