summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--src/format/dex/class.c30
-rw-r--r--src/format/dex/method.c19
-rw-r--r--src/format/dex/method.h3
4 files changed, 49 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 8f374bd..12f44fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+17-05-08 Cyrille Bagard <nocbos@gmail.com>
+
+ * src/format/dex/class.c:
+ Ensure a Dex routine is not abstract nor native before adding a symbol into the disassembled code.
+
+ * src/format/dex/method.c:
+ * src/format/dex/method.h:
+ Provide a a way to know if there is a body for a given method.
+
17-05-07 Cyrille Bagard <nocbos@gmail.com>
* src/analysis/disass/area.c:
diff --git a/src/format/dex/class.c b/src/format/dex/class.c
index 3822546..897720a 100644
--- a/src/format/dex/class.c
+++ b/src/format/dex/class.c
@@ -248,16 +248,19 @@ GDexClass *g_dex_class_new(GDexFormat *format, const class_def_item *def)
result->direct_methods[i] = method;
/* Ajout à la liste des symboles */
+ if (g_dex_method_has_dex_body(method))
+ {
+ routine = g_dex_method_get_routine(method);
- routine = g_dex_method_get_routine(method);
+ g_object_ref(G_OBJECT(ctype));
+ g_binary_routine_set_namespace(routine, ctype, ".");
- g_object_ref(G_OBJECT(ctype));
- g_binary_routine_set_namespace(routine, ctype, ".");
+ symbol = g_binary_symbol_new(STP_ROUTINE);
+ g_binary_symbol_attach_routine(symbol, routine);
- symbol = g_binary_symbol_new(STP_ROUTINE);
- g_binary_symbol_attach_routine(symbol, routine);
+ g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol);
- g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol);
+ }
}
@@ -274,16 +277,19 @@ GDexClass *g_dex_class_new(GDexFormat *format, const class_def_item *def)
result->virtual_methods[i] = method;
/* Ajout à la liste des symboles */
+ if (g_dex_method_has_dex_body(method))
+ {
+ routine = g_dex_method_get_routine(method);
- routine = g_dex_method_get_routine(method);
+ g_object_ref(G_OBJECT(ctype));
+ g_binary_routine_set_namespace(routine, ctype, ".");
- g_object_ref(G_OBJECT(ctype));
- g_binary_routine_set_namespace(routine, ctype, ".");
+ symbol = g_binary_symbol_new(STP_ROUTINE);
+ g_binary_symbol_attach_routine(symbol, routine);
- symbol = g_binary_symbol_new(STP_ROUTINE);
- g_binary_symbol_attach_routine(symbol, routine);
+ g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol);
- g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol);
+ }
}
diff --git a/src/format/dex/method.c b/src/format/dex/method.c
index c803bd0..be99479 100644
--- a/src/format/dex/method.c
+++ b/src/format/dex/method.c
@@ -294,6 +294,25 @@ const encoded_method *g_dex_method_get_dex_info(const GDexMethod *method)
* *
* Paramètres : method = représentation interne de la méthode à consulter. *
* *
+* Description : Indique si du code est rattaché à une méthode Dex. *
+* *
+* Retour : true si la méthode n'est pas abstraite ni native. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_dex_method_has_dex_body(const GDexMethod *method)
+{
+ return method->has_body;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : method = représentation interne de la méthode à consulter. *
+* *
* Description : Fournit les indications Dex relatives au corps de la méthode.*
* *
* Retour : Données brutes du binaire. *
diff --git a/src/format/dex/method.h b/src/format/dex/method.h
index cb1f6e2..e5b8634 100644
--- a/src/format/dex/method.h
+++ b/src/format/dex/method.h
@@ -75,6 +75,9 @@ GDexMethod *g_dex_method_new_callable(GDexFormat *, const method_id_item *);
/* Fournit les indications Dex concernant la méthode. */
const encoded_method *g_dex_method_get_dex_info(const GDexMethod *);
+/* Indique si du code est rattaché à une méthode Dex. */
+bool g_dex_method_has_dex_body(const GDexMethod *);
+
/* Fournit les indications Dex relatives au corps de la méthode. */
const code_item *g_dex_method_get_dex_body(const GDexMethod *);