This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Fixed issue with NULL pointer access on header var.
- From: Cupertino dot Miranda at synopsys dot com
- To: binutils at sourceware dot org
- Cc: Claudiu dot Zissulescu at synopsys dot com, Francois dot Bedard at synopsys dot com, Cupertino Miranda <Cupertino dot Miranda at synopsys dot com>
- Date: Mon, 29 Aug 2016 12:06:50 +0200
- Subject: [PATCH] Fixed issue with NULL pointer access on header var.
- Authentication-results: sourceware.org; auth=none
From: Cupertino Miranda <cmiranda@synopsys.com>
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,
Cupertino
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/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:
default:
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. */
--
2.9.0