diff options
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/disass/links.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/analysis/disass/links.c b/src/analysis/disass/links.c index 8d826c5..5e1e483 100644 --- a/src/analysis/disass/links.c +++ b/src/analysis/disass/links.c @@ -26,6 +26,7 @@ #include "../../arch/instruction.h" +#include "../../arch/raw.h" #include "../../arch/target.h" @@ -128,6 +129,7 @@ static void establish_natural_link(GArchInstruction *instr, GArchInstruction *pr static void convert_immediate_into_target(GArchInstruction *instr, size_t index, GBinFormat *format) { GArchOperand *op; /* Opérande numérique en place */ + GImmOperand *imm; /* Version native de l'opérande*/ virt_t addr; /* Adresse visée par le saut */ MemoryDataSize msize; /* Taille de l'opérande */ GArchOperand *new; /* Instruction de ciblage */ @@ -135,9 +137,13 @@ static void convert_immediate_into_target(GArchInstruction *instr, size_t index, op = g_arch_instruction_get_operand(instr, index); if (!G_IS_IMM_OPERAND(op)) return; - if (g_imm_operand_to_virt_t(G_IMM_OPERAND(op), &addr)) + imm = G_IMM_OPERAND(op); + + if (g_imm_operand_get_display(imm) != IOD_HEX) return; + + if (g_imm_operand_to_virt_t(imm, &addr)) { - msize = g_imm_operand_get_size(G_IMM_OPERAND(op)); + msize = g_imm_operand_get_size(imm); new = g_target_operand_new(msize, addr); @@ -167,6 +173,7 @@ static void convert_immediate_into_target(GArchInstruction *instr, size_t index, static void establish_links_for_instruction(GArchInstruction *instr, GArchInstruction *list, GBinFormat *format) { + bool skip; /* Saut des conversions */ size_t count; /* Nombre d'opérandes présents */ size_t i; /* Boucle de parcours */ GArchOperand *op; /* Opérande numérique en place */ @@ -174,11 +181,17 @@ static void establish_links_for_instruction(GArchInstruction *instr, GArchInstru vmpa2t addr; /* Localisation plus complète */ GArchInstruction *target; /* Instruction visée au final */ + if (G_IS_RAW_INSTRUCTION(instr)) + skip = g_raw_instruction_is_string(G_RAW_INSTRUCTION(instr)); + else + skip = false; + count = g_arch_instruction_count_operands(instr); for (i = 0; i < count; i++) { - convert_immediate_into_target(instr, i, format); + if (!skip) + convert_immediate_into_target(instr, i, format); op = g_arch_instruction_get_operand(instr, i); if (!G_IS_TARGET_OPERAND(op)) continue; |