diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-03-06 18:48:16 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-03-06 18:48:16 (GMT) |
commit | 12b8a066d1d8dd8cbef587dc6fafed870604f49f (patch) | |
tree | 3eb6cfbab886b430a8479fda9a721f75ae806a4d /plugins | |
parent | 0320d85e480882c58f254640a54c6c6e190dbf47 (diff) |
Locked access to instruction operands when needed.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/androhelpers/params.c | 8 | ||||
-rw-r--r-- | plugins/stackvars/stackvars.c | 10 |
2 files changed, 13 insertions, 5 deletions
diff --git a/plugins/androhelpers/params.c b/plugins/androhelpers/params.c index 908d8c6..ea85b89 100644 --- a/plugins/androhelpers/params.c +++ b/plugins/androhelpers/params.c @@ -149,11 +149,13 @@ static void visit_all_method_operands(const GDexMethod *method, GArchInstruction iter != NULL; iter = g_arch_instruction_get_next_iter(instrs, iter, end)) { - count = g_arch_instruction_count_operands(iter); + g_arch_instruction_lock_operands(iter); + + count = _g_arch_instruction_count_operands(iter); for (i = 0; i < count; i++) { - operand = g_arch_instruction_get_operand(iter, i); + operand = _g_arch_instruction_get_operand(iter, i); if (G_IS_DALVIK_REGISTER_OPERAND(operand)) process_register_operand(method, operand); @@ -163,6 +165,8 @@ static void visit_all_method_operands(const GDexMethod *method, GArchInstruction } + g_arch_instruction_unlock_operands(iter); + } } diff --git a/plugins/stackvars/stackvars.c b/plugins/stackvars/stackvars.c index c2b4777..f3baeef 100644 --- a/plugins/stackvars/stackvars.c +++ b/plugins/stackvars/stackvars.c @@ -205,16 +205,18 @@ static bool replace_stack_vars_in_instruction(GArchInstruction *instr, GBinRouti result = false; new = NULL; /* Pour GCC */ - opcount = g_arch_instruction_count_operands(instr); + g_arch_instruction_lock_operands(instr); + + opcount = _g_arch_instruction_count_operands(instr); for (i = 0; i < opcount; i++) { - operand = g_arch_instruction_get_operand(instr, i); + operand = _g_arch_instruction_get_operand(instr, i); result = replace_stack_var_in_operand(operand, routine, dryrun, &new); if (!dryrun && result) { - g_arch_instruction_replace_operand(instr, new, operand); + _g_arch_instruction_replace_operand(instr, new, operand); result = true; @@ -222,6 +224,8 @@ static bool replace_stack_vars_in_instruction(GArchInstruction *instr, GBinRouti } + g_arch_instruction_unlock_operands(instr); + return result; } |