From 10ce277a45469fa194e0d5fa2f0ca531f1830191 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Thu, 19 Mar 2015 07:26:53 +0000 Subject: Fixed an invalid cast between two GLib instances in some cases. git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@492 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a --- ChangeLog | 5 +++++ src/arch/raw.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2dcb1d2..e491d22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +15-03-19 Cyrille Bagard + + * src/arch/raw.c: + Fix an invalid cast between two GLib instances in some cases. + 15-03-18 Cyrille Bagard * src/analysis/disass/area.c: diff --git a/src/arch/raw.c b/src/arch/raw.c index 3338613..cf990f0 100644 --- a/src/arch/raw.c +++ b/src/arch/raw.c @@ -31,6 +31,7 @@ #include "immediate.h" #include "instruction-int.h" +#include "target.h" @@ -508,7 +509,11 @@ static void g_raw_instruction_build_keyword(const GRawInstruction *instr, AsmSyn static char *defines[] = { "dn", "db", "dw", "dd", "dq" }; operand = g_arch_instruction_get_operand(G_ARCH_INSTRUCTION(instr), 0); - size = g_imm_operand_get_size(G_IMM_OPERAND(operand)); + + if (G_IS_TARGET_OPERAND(operand)) + size = g_target_operand_get_size(G_TARGET_OPERAND(operand)); + else + size = g_imm_operand_get_size(G_IMM_OPERAND(operand)); G_ARCH_INSTRUCTION(instr)->cached_keyword = strdup(defines[MDS_RANGE(size)]); -- cgit v0.11.2-87-g4458