diff options
Diffstat (limited to 'plugins/androhelpers/try_n_catch.c')
-rw-r--r-- | plugins/androhelpers/try_n_catch.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/plugins/androhelpers/try_n_catch.c b/plugins/androhelpers/try_n_catch.c index 27c7959..d2ab4a9 100644 --- a/plugins/androhelpers/try_n_catch.c +++ b/plugins/androhelpers/try_n_catch.c @@ -58,7 +58,7 @@ static void mark_exception_handlers(const GLoadedBinary *, uleb128_t, caught_exc static caught_exception **build_all_destinations_list(const GLoadedBinary *, const GBinRoutine *, const encoded_catch_handler_list *, size_t **); /* Recherche et met en avant tous les gestionnaires d'exception. */ -static void look_for_exception_handlers(const GLoadedBinary *, const GDexFormat *, GDexMethod *); +static void look_for_exception_handlers(const GLoadedBinary *, const GDexFormat *, GDexMethod *, bool); @@ -127,7 +127,7 @@ static void attach_caught_code(const GLoadedBinary *binary, const GBinRoutine *r first = g_arch_instruction_find_by_address(instrs, start, true); next = g_arch_instruction_find_by_address(instrs, end, true); - if (start == NULL || next == NULL) + if (first == NULL || next == NULL) return; /* Si des détachements sont nécessaires... */ @@ -312,6 +312,7 @@ static caught_exception **build_all_destinations_list(const GLoadedBinary *binar * Paramètres : binary = représentation binaire à traiter. * * format = format du binaire Dex. * * method = méthode à analyser. * +* link = édition de liens ou impression de commentaires ? * * * * Description : Recherche et met en avant tous les gestionnaires d'exception.* * * @@ -321,7 +322,7 @@ static caught_exception **build_all_destinations_list(const GLoadedBinary *binar * * ******************************************************************************/ -static void look_for_exception_handlers(const GLoadedBinary *binary, const GDexFormat *format, GDexMethod *method) +static void look_for_exception_handlers(const GLoadedBinary *binary, const GDexFormat *format, GDexMethod *method, bool link) { const code_item *body; /* Description du corps */ GBinRoutine *routine; /* Abstraction globale */ @@ -343,29 +344,29 @@ static void look_for_exception_handlers(const GLoadedBinary *binary, const GDexF hlist = body->handlers; handlers = build_all_destinations_list(binary, routine, hlist, &count); - /* Pour chaque zone couverte... */ - - for (i = 0; i < body->tries_size; i++) - { - try = &body->tries[i]; - - if (!check_covered_area(try, routine)) - continue; + if (link) + /* Pour chaque zone couverte... */ + for (i = 0; i < body->tries_size; i++) + { + try = &body->tries[i]; - for (index = 0; index < hlist->size; index++) - if (try->handler_off == hlist->list[index].offset) - break; + if (!check_covered_area(try, routine)) + continue; - if (index == hlist->size) - continue; + for (index = 0; index < hlist->size; index++) + if (try->handler_off == hlist->list[index].offset) + break; - attach_caught_code(binary, routine, try, handlers[index], count[index]); + if (index == hlist->size) + continue; - } + attach_caught_code(binary, routine, try, handlers[index], count[index]); - /* Ajout des précisions */ + } - mark_exception_handlers(binary, hlist->size, handlers, count); + else + /* Ajout des précisions */ + mark_exception_handlers(binary, hlist->size, handlers, count); /* Libération de la mémoire utilisée */ @@ -388,6 +389,7 @@ static void look_for_exception_handlers(const GLoadedBinary *binary, const GDexF /****************************************************************************** * * * Paramètres : binary = représentation binaire à traiter. * +* link = édition de liens ou impression de commentaires ? * * * * Description : Traite tous les gestionnaires d'exception trouvés. * * * @@ -397,7 +399,7 @@ static void look_for_exception_handlers(const GLoadedBinary *binary, const GDexF * * ******************************************************************************/ -bool process_exception_handlers(GLoadedBinary *binary) +bool process_exception_handlers(GLoadedBinary *binary, bool link) { GDexFormat *format; /* Format du binaire chargé */ size_t cls_count; /* Nombre de classes trouvées */ @@ -421,14 +423,14 @@ bool process_exception_handlers(GLoadedBinary *binary) for (j = 0; j < meth_count; j++) { method = g_dex_class_get_method(class, false, j); - look_for_exception_handlers(binary, format, method); + look_for_exception_handlers(binary, format, method, link); } meth_count = g_dex_class_count_methods(class, true); for (j = 0; j < meth_count; j++) { method = g_dex_class_get_method(class, true, j); - look_for_exception_handlers(binary, format, method); + look_for_exception_handlers(binary, format, method, link); } } |