aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-12-14 14:46:07 +1030
committerAlan Modra <amodra@gmail.com>2022-12-14 21:45:04 +1030
commitad2f3a3f72a57fcce5213567fd77d920e953316a (patch)
tree431fc856c49e29dd6db58650b1a6048736d7fc29 /bfd
parentd1da8dd5bdfec6172afc5e3202e6c18541a1b2d3 (diff)
downloadfsf-binutils-gdb-ad2f3a3f72a57fcce5213567fd77d920e953316a.zip
fsf-binutils-gdb-ad2f3a3f72a57fcce5213567fd77d920e953316a.tar.gz
fsf-binutils-gdb-ad2f3a3f72a57fcce5213567fd77d920e953316a.tar.bz2
asan: buffer overflow in sh_reloc
* coff-sh.c (sh_reloc): Use bfd_reloc_offset_in_range.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/coff-sh.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c
index c5b69a8..d030c47 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);