summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/androhelpers/params.c8
-rw-r--r--plugins/androhelpers/switch.c8
-rw-r--r--plugins/androhelpers/try_n_catch.c17
3 files changed, 26 insertions, 7 deletions
diff --git a/plugins/androhelpers/params.c b/plugins/androhelpers/params.c
index 6993821..df56fca 100644
--- a/plugins/androhelpers/params.c
+++ b/plugins/androhelpers/params.c
@@ -180,8 +180,9 @@ static void visit_all_method_operands(const GDexMethod *method, GArchInstruction
bool replace_parameters(GLoadedBinary *binary)
{
- GArchInstruction *instrs; /* Instructions Dalvik */
GDexFormat *format; /* Format du binaire chargé */
+ GArchProcessor *proc; /* Processeur de l'architecture*/
+ GArchInstruction *instrs; /* Instructions Dalvik */
size_t cls_count; /* Nombre de classes trouvées */
size_t i; /* Boucle de parcours #1 */
GDexClass *class; /* Classe à analyser */
@@ -189,8 +190,9 @@ bool replace_parameters(GLoadedBinary *binary)
size_t j; /* Boucle de parcours #2 */
GDexMethod *method; /* Méthode à parcourir */
- instrs = g_loaded_binary_get_instructions(binary);
format = G_DEX_FORMAT(g_loaded_binary_get_format(binary));
+ proc = g_loaded_binary_get_processor(binary);
+ instrs = g_arch_processor_get_disassembled_instructions(proc);
cls_count = g_dex_format_count_classes(format);
for (i = 0; i < cls_count; i++)
@@ -213,6 +215,8 @@ bool replace_parameters(GLoadedBinary *binary)
}
+ g_object_unref(G_OBJECT(proc));
+
return true;
}
diff --git a/plugins/androhelpers/switch.c b/plugins/androhelpers/switch.c
index f93c9e9..a5a8a75 100644
--- a/plugins/androhelpers/switch.c
+++ b/plugins/androhelpers/switch.c
@@ -383,8 +383,9 @@ static void look_for_switch_instructions(const GDexMethod *method, GArchInstruct
bool extract_switch_info(GLoadedBinary *binary, bool link)
{
- GArchInstruction *instrs; /* Instructions Dalvik */
GDexFormat *format; /* Format du binaire chargé */
+ GArchProcessor *proc; /* Processeur de l'architecture*/
+ GArchInstruction *instrs; /* Instructions Dalvik */
size_t cls_count; /* Nombre de classes trouvées */
size_t i; /* Boucle de parcours #1 */
GDexClass *class; /* Classe à analyser */
@@ -392,8 +393,9 @@ bool extract_switch_info(GLoadedBinary *binary, bool link)
size_t j; /* Boucle de parcours #2 */
GDexMethod *method; /* Méthode à parcourir */
- instrs = g_loaded_binary_get_instructions(binary);
format = G_DEX_FORMAT(g_loaded_binary_get_format(binary));
+ proc = g_loaded_binary_get_processor(binary);
+ instrs = g_arch_processor_get_disassembled_instructions(proc);
cls_count = g_dex_format_count_classes(format);
for (i = 0; i < cls_count; i++)
@@ -416,6 +418,8 @@ bool extract_switch_info(GLoadedBinary *binary, bool link)
}
+ g_object_unref(G_OBJECT(proc));
+
return true;
}
diff --git a/plugins/androhelpers/try_n_catch.c b/plugins/androhelpers/try_n_catch.c
index 94be140..d2c6043 100644
--- a/plugins/androhelpers/try_n_catch.c
+++ b/plugins/androhelpers/try_n_catch.c
@@ -111,6 +111,7 @@ static void attach_caught_code(const GLoadedBinary *binary, const GBinRoutine *r
{
vmpa_t start; /* Début de la zone couverte */
vmpa_t end; /* Fin de la zone couverte */
+ GArchProcessor *proc; /* Processeur de l'architecture*/
GArchInstruction *instrs; /* Instructions Dalvik */
GArchInstruction *first; /* Première instruction */
GArchInstruction *next; /* Dernière instruction + 1 */
@@ -123,12 +124,14 @@ static void attach_caught_code(const GLoadedBinary *binary, const GBinRoutine *r
end = start + try->insn_count * sizeof(uint16_t);
- instrs = g_loaded_binary_get_instructions(binary);
+ proc = g_loaded_binary_get_processor(binary);
+ instrs = g_arch_processor_get_disassembled_instructions(proc);
+
first = g_arch_instruction_find_by_address(instrs, start, true);
next = g_arch_instruction_find_by_address(instrs, end, true);
if (first == NULL || next == NULL)
- return;
+ goto acc_exit;
/* Si des détachements sont nécessaires... */
@@ -162,6 +165,10 @@ static void attach_caught_code(const GLoadedBinary *binary, const GBinRoutine *r
}
+ acc_exit:
+
+ g_object_unref(G_OBJECT(proc));
+
}
@@ -232,6 +239,7 @@ static caught_exception **build_all_destinations_list(const GLoadedBinary *binar
caught_exception **result; /* Liste de listes à retourner */
GDexFormat *format; /* Format du binaire chargé */
vmpa_t start; /* Début du code de la routine */
+ GArchProcessor *proc; /* Processeur de l'architecture*/
GArchInstruction *instrs; /* Instructions Dalvik */
uleb128_t i; /* Boucle de parcours #1 */
encoded_catch_handler *handlers; /* Groupe de gestionnaires */
@@ -244,7 +252,8 @@ static caught_exception **build_all_destinations_list(const GLoadedBinary *binar
start = g_binary_routine_get_address(routine);
- instrs = g_loaded_binary_get_instructions(binary);
+ proc = g_loaded_binary_get_processor(binary);
+ instrs = g_arch_processor_get_disassembled_instructions(proc);
instrs = g_arch_instruction_find_by_address(instrs, start, true);
/* Création d'un espace mémoire pour les listes */
@@ -302,6 +311,8 @@ static caught_exception **build_all_destinations_list(const GLoadedBinary *binar
}
+ g_object_unref(G_OBJECT(proc));
+
return result;
}