From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id 6A05E382FC9B; Wed, 14 Dec 2022 11:44:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A05E382FC9B Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: bfd-cvs@sourceware.org Subject: [binutils-gdb] asan: buffer overflow in sh_reloc X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: d1da8dd5bdfec6172afc5e3202e6c18541a1b2d3 X-Git-Newrev: ad2f3a3f72a57fcce5213567fd77d920e953316a Message-Id: <20221214114418.6A05E382FC9B@sourceware.org> Date: Wed, 14 Dec 2022 11:44:18 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Dec 2022 11:44:18 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dad2f3a3f72a5= 7fcce5213567fd77d920e953316a commit ad2f3a3f72a57fcce5213567fd77d920e953316a Author: Alan Modra Date: Wed Dec 14 14:46:07 2022 +1030 asan: buffer overflow in sh_reloc =20 * 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; =20 - if (addr > input_section->size) + if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd, input_section, + addr)) return bfd_reloc_outofrange; =20 sym_value =3D get_symbol_value (symbol_in);