public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] asan: buffer overflow in sh_reloc
@ 2022-12-14 11:44 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-12-14 11:44 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ad2f3a3f72a57fcce5213567fd77d920e953316a

commit ad2f3a3f72a57fcce5213567fd77d920e953316a
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Dec 14 14:46:07 2022 +1030

    asan: buffer overflow in sh_reloc
    
            * coff-sh.c (sh_reloc): Use bfd_reloc_offset_in_range.

Diff:
---
 bfd/coff-sh.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-14 11:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-14 11:44 [binutils-gdb] asan: buffer overflow in sh_reloc Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).