[PATCH] opcodes/nfp: skip those non-code sections

Yinjun Zhang yinjun.zhang@corigine.com
Tue Aug 24 13:14:03 GMT 2021


AddressSanitizer detects heap-buffer-overflow when running
"objdump -D" for nfp .nffw files.

Currently nfp disassemblers can only support code section, and
we don't require to disassmeble other sections for now. So skip
the non-code sections.

Signed-off-by: Yinjun Zhang <yinjun.zhang@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
---
 opcodes/nfp-dis.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/opcodes/nfp-dis.c b/opcodes/nfp-dis.c
index b74ccb3fce5..6202b12e8fd 100644
--- a/opcodes/nfp-dis.c
+++ b/opcodes/nfp-dis.c
@@ -2950,6 +2950,14 @@ print_insn_nfp (bfd_vma addr, struct disassemble_info *dinfo)
   nfp_opts opts;
   int err;
 
+  /* Currently only disassemble the text section */
+  if (!(dinfo->section->flags & SEC_CODE))
+    {
+      dinfo->fprintf_func (dinfo->stream,
+                           "Disassembly of this section is not supported\t # SKIP");
+      return -1;
+    }
+
   opts.show_pc = 1;
   opts.ctx_mode = 0;
   err = parse_disassembler_options (&opts, dinfo);
-- 
2.27.0



More information about the Binutils mailing list