aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2024-06-05 13:30:27 +0100
committerNick Clifton <nickc@redhat.com>2024-06-05 13:30:27 +0100
commit2db414c36b4f030782c2c8a24c916c3033261af0 (patch)
tree0f5d2d65b2b1c0e51e9878c7cb8c4956b9e608d3 /opcodes
parent3d7627c2d08e722774a8c7c34c154d9436177842 (diff)
downloadbinutils-2db414c36b4f030782c2c8a24c916c3033261af0.zip
binutils-2db414c36b4f030782c2c8a24c916c3033261af0.tar.gz
binutils-2db414c36b4f030782c2c8a24c916c3033261af0.tar.bz2
Fix illegal memory access when bfd_get_section_contents is called with a NULL section pointer.
PR 31843
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/nfp-dis.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/opcodes/nfp-dis.c b/opcodes/nfp-dis.c
index 093c567..ade5fd1 100644
--- a/opcodes/nfp-dis.c
+++ b/opcodes/nfp-dis.c
@@ -2559,6 +2559,13 @@ init_nfp3200_priv (nfp_priv_data * priv, struct disassemble_info *dinfo)
return false;
}
+ if (sec->bfd_section == NULL)
+ {
+ /* See PR 31843 for an example of this. */
+ dinfo->fprintf_func (dinfo->stream, _("The ME-Config section is corrupt."));
+ return false;
+ }
+
for (roff = 0; (bfd_size_type) roff < sec->sh_size;
roff += sec->sh_entsize, menum_linear++)
{