asan: buffer overflow in sh_reloc

* coff-sh.c (sh_reloc): Use bfd_reloc_offset_in_range.
This commit is contained in:
Alan Modra
2022-12-14 14:46:07 +10:30
parent d1da8dd5bd
commit ad2f3a3f72

View File

@ -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);