public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] Re: loongarch readelf support
Date: Sat,  3 Jun 2023 08:06:35 +0000 (GMT)	[thread overview]
Message-ID: <20230603080635.4B6CE3857733@sourceware.org> (raw)

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

commit 89c70cd358b8fa46b84cd100efc95495ff0160ae
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Jun 3 17:16:04 2023 +0930

    Re: loongarch readelf support
    
    Another segfault.
    
            * readelf.c (target_specific_reloc_handling): Sanity check
            loongarch reloc r_offset.

Diff:
---
 binutils/readelf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/binutils/readelf.c b/binutils/readelf.c
index 042d2301517..23d3e21bea6 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -14021,8 +14021,9 @@ target_specific_reloc_handling (Filedata *filedata,
 		unsigned int reloc_size = 0;
 		int leb_ret = 0;
 
-		value = read_leb128 (start + reloc->r_offset, end, false,
-			      &reloc_size, &leb_ret);
+		if (reloc->r_offset < (size_t) (end - start))
+		  value = read_leb128 (start + reloc->r_offset, end, false,
+				       &reloc_size, &leb_ret);
 		if (leb_ret != 0 || reloc_size == 0 || reloc_size > 8)
 		  error (_("LoongArch ULEB128 field at 0x%lx contains invalid "
 			   "ULEB128 value\n"),

             reply	other threads:[~2023-06-03  8:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-03  8:06 Alan Modra [this message]
2023-06-06 10:43 Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230603080635.4B6CE3857733@sourceware.org \
    --to=amodra@sourceware.org \
    --cc=bfd-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).