diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/androhelpers/switch.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/plugins/androhelpers/switch.c b/plugins/androhelpers/switch.c index 9e6f306..0a1e488 100644 --- a/plugins/androhelpers/switch.c +++ b/plugins/androhelpers/switch.c @@ -27,6 +27,7 @@ #include <string.h> +#include <arch/immediate.h> #include <arch/dalvik/instruction.h> #include <arch/dalvik/instruction-def.h> #include <arch/dalvik/operands/target.h> @@ -139,6 +140,8 @@ static void link_all_switch_cases(GArchInstruction *instr, const dex_switch *dsw uint32_t *targets; /* Cibles relatives à corriger */ uint16_t i; /* Boucle de parcours */ GArchInstruction *next; /* Instruction suivante */ + uint32_t value; /* Valeur à indiquer */ + GArchOperand *imm; /* Forme de la valeur reconnue */ /* Valeurs définies */ @@ -155,7 +158,16 @@ static void link_all_switch_cases(GArchInstruction *instr, const dex_switch *dsw next = g_arch_instruction_find_by_address(instrs, (vmpa_t)targets[i], true); if (next != NULL) - g_arch_instruction_link_with(instr, next, ILT_CASE_JUMP); + { + if (dswitch->packed.ident == DPO_PACKED_SWITCH) + value = dswitch->packed.first_key + i; + else + value = dswitch->sparse.keys[i]; + + imm = g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, value); + g_arch_instruction_link_with(instr, next, ILT_CASE_JUMP, imm); + + } } @@ -164,7 +176,7 @@ static void link_all_switch_cases(GArchInstruction *instr, const dex_switch *dsw next = g_arch_instruction_get_next_iter(instrs, instr, end); if (next != NULL) - g_arch_instruction_link_with(instr, next, ILT_CASE_JUMP); + g_arch_instruction_link_with(instr, next, ILT_CASE_JUMP, NULL); } |