From: Alan Modra Date: Wed, 14 Dec 2022 04:16:07 +0000 (+1030) Subject: asan: buffer overflow in sh_reloc X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ad2f3a3f72a57fcce5213567fd77d920e953316a;p=binutils-gdb.git asan: buffer overflow in sh_reloc * coff-sh.c (sh_reloc): Use bfd_reloc_offset_in_range. --- diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index c5b69a8592f..d030c475539 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -597,7 +597,8 @@ sh_reloc (bfd * abfd, && bfd_is_und_section (symbol_in->section)) return bfd_reloc_undefined; - if (addr > input_section->size) + if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd, input_section, + addr)) return bfd_reloc_outofrange; sym_value = get_symbol_value (symbol_in);