Fix illegal memory access when disassembling corrupt NFP binaries.
authorNick Clifton <nickc@redhat.com>
Tue, 11 Apr 2023 13:54:26 +0000 (14:54 +0100)
committerNick Clifton <nickc@redhat.com>
Tue, 11 Apr 2023 13:54:26 +0000 (14:54 +0100)
  PR 30310
  * nfp-dis.c (init_nfp6000_priv): Check that the output section exists.

opcodes/ChangeLog
opcodes/nfp-dis.c

index e8a224bc424e7e5614ecd1b42bf96832e6c5722b..a25c20d2fb9fdbf26a551591aba6a64ab5180f58 100644 (file)
@@ -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
index a3d394e44dc6d6580b8d66de94d00dbe8df06cc5..975fa697c5575bfacaa51bf5cea9389877d77ce9 100644 (file)
@@ -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;