public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] Fix illegal memory access when disassembling corrupt NFP binaries.
Date: Tue, 11 Apr 2023 13:54:59 +0000 (GMT)	[thread overview]
Message-ID: <20230411135459.A38F83858C53@sourceware.org> (raw)

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

commit 37522c873e86dd4941b9cdf38116f31d447d2234
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Apr 11 14:54:26 2023 +0100

    Fix illegal memory access when disassembling corrupt NFP binaries.
    
      PR 30310
      * nfp-dis.c (init_nfp6000_priv): Check that the output section exists.

Diff:
---
 opcodes/ChangeLog | 6 ++++++
 opcodes/nfp-dis.c | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index e8a224bc424..a25c20d2fb9 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,9 @@
+2023-04-11  Nick Clifton  <nickc@redhat.com>
+
+	PR 30310
+	* nfp-dis.c (init_nfp6000_priv): Check that the output section
+	exists.
+
 2023-03-15  Nick Clifton  <nickc@redhat.com>
 
 	PR 30231
diff --git a/opcodes/nfp-dis.c b/opcodes/nfp-dis.c
index a3d394e44dc..975fa697c55 100644
--- a/opcodes/nfp-dis.c
+++ b/opcodes/nfp-dis.c
@@ -2676,7 +2676,9 @@ init_nfp6000_priv (nfp_priv_data * priv, struct disassemble_info *dinfo)
 
   memset (mecfg_orders, -1, sizeof (mecfg_orders));
 
-  if (!dinfo->section)
+  if (dinfo->section == NULL
+      || dinfo->section->owner == NULL
+      || elf_elfsections (dinfo->section->owner) == NULL)
     /* No section info, will use default values.  */
     return true;

                 reply	other threads:[~2023-04-11 13:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230411135459.A38F83858C53@sourceware.org \
    --to=nickc@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).