summaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2023-04-11 14:54:26 +0100
committerNick Clifton <nickc@redhat.com>2023-04-11 14:54:26 +0100
commit37522c873e86dd4941b9cdf38116f31d447d2234 (patch)
tree55510d51e42565a00a20a4a824e2b11d4d7f48d0 /opcodes
parent7594741ebc2700a36fb77acfc6515dbfca4ed0dc (diff)
downloadbinutils-gdb-37522c873e86dd4941b9cdf38116f31d447d2234.tar.gz
Fix illegal memory access when disassembling corrupt NFP binaries.
PR 30310 * nfp-dis.c (init_nfp6000_priv): Check that the output section exists.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog6
-rw-r--r--opcodes/nfp-dis.c4
2 files changed, 9 insertions, 1 deletions
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;