Fixed issue with NULL pointer access on header var.
authorCupertino Miranda <cmiranda@synopsys.com>
Fri, 26 Aug 2016 20:15:23 +0000 (22:15 +0200)
committerCupertino Miranda <cmiranda@synopsys.com>
Tue, 30 Aug 2016 16:21:13 +0000 (18:21 +0200)
Variable "header" in function is set conditionally, but was accessed without
verifying if pointer was NULL.

opcodes/ChangeLog:

    Cupertino Miranda  <cmiranda@synopsys.com>
* opcodes/arc-dis.c (print_insn_arc): Changed.

opcodes/ChangeLog
opcodes/arc-dis.c

index 9e41bc548827f45353cefb325acddf710d617446..fdb78afec13a1e74b1a585c0f19029f06439ff24 100644 (file)
@@ -1,3 +1,7 @@
+2016-08-30  Cupertino Miranda  <cmiranda@synopsys.com>
+
+       * opcodes/arc-dis.c (print_insn_arc): Changed.
+
 2016-08-26  Jose E. Marchesi  <jose.marchesi@oracle.com>
 
        * sparc-opc.c (sparc_opcodes): Fix typo in opcode, camellia_fi ->
index 73d648d8cf435d6b9de0903d4542ccc26eac08e3..d69a01e4e4d568f17ac643ed3f7486cd228a8aba 100644 (file)
@@ -938,7 +938,10 @@ print_insn_arc (bfd_vma memaddr,
     case bfd_mach_arc_arcv2:
     default:
       isa_mask = ARC_OPCODE_ARCv2EM;
-      if ((header->e_flags & EF_ARC_MACH_MSK) == EF_ARC_CPU_ARCV2HS)
+      /* TODO: Perhaps remove defitinion of header since it is only used at
+         this location.  */
+      if (header != NULL
+         && (header->e_flags & EF_ARC_MACH_MSK) == EF_ARC_CPU_ARCV2HS)
        {
          isa_mask = ARC_OPCODE_ARCv2HS;
          /* FPU instructions are not extensions for HS.  */