This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fixed issue with NULL pointer access on header var.

From: Cupertino Miranda <>

Hello everyone,

This patches addresses a problem with NULL pointer which is set
conditionally, but is accessed unconditionally.
Looking forward for your comments.

Best regards,

Variable "header" in function is set conditionally, but was accessed without
verifying if pointer was NULL.


    Cupertino Miranda  <>
	* opcodes/arc-dis.c (print_insn_arc): Changed.
 opcodes/arc-dis.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c
index 73d648d..da136a1 100644
--- a/opcodes/arc-dis.c
+++ b/opcodes/arc-dis.c
@@ -938,7 +938,8 @@ print_insn_arc (bfd_vma memaddr,
     case bfd_mach_arc_arcv2:
       isa_mask = ARC_OPCODE_ARCv2EM;
-      if ((header->e_flags & EF_ARC_MACH_MSK) == EF_ARC_CPU_ARCV2HS)
+      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.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]