summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-09-12 21:21:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-09-12 21:21:53 (GMT)
commit680a2ea1523c79741461649b6528c083d2cec603 (patch)
treeee5ce4d8771e8aac8427c89c12ec200a7668c964 /plugins
parent0f1473cba267ad809c8e7d207b5ff5e3998745fc (diff)
Fixed two more bugs when annotating Dex code items.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/readdex/code.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/plugins/readdex/code.c b/plugins/readdex/code.c
index 24813ea..d13ce52 100644
--- a/plugins/readdex/code.c
+++ b/plugins/readdex/code.c
@@ -37,7 +37,7 @@
/* Commente les définitions d'une protection contre exceptions. */
-static bool annotate_dex_try_item(const GDexFormat *, vmpa2t *, const vmpa2t *);
+static bool annotate_dex_try_item(const GDexFormat *, vmpa2t *);
/*Commente les définitions des listes de gestion d'exceptions. */
static bool annotate_dex_encoded_catch_handler_list(const GDexFormat *, vmpa2t *);
@@ -76,7 +76,6 @@ bool annotate_dex_code_item(const GDexFormat *format, uleb128_t offset)
char *text; /* Texte constant à insérer */
uint16_t tries_size; /* Nombre de gestionnaires */
uint32_t insns_size; /* Nombre d'instructions */
- vmpa2t handlers; /* Base des gestionnaires */
uint16_t i; /* Boucle de parcours */
content = g_binary_format_get_content(G_BIN_FORMAT(format));
@@ -193,13 +192,13 @@ bool annotate_dex_code_item(const GDexFormat *format, uleb128_t offset)
/* tries */
- copy_vmpa(&handlers, &pos);
- advance_vmpa(&handlers, tries_size * (4 + 2 + 2));
-
result = true;
for (i = 0; i < tries_size && result; i++)
- result = annotate_dex_try_item(format, &pos, &handlers);
+ result = annotate_dex_try_item(format, &pos);
+
+ if (tries_size > 0 && result)
+ result = annotate_dex_encoded_catch_handler_list(format, &pos);
/* Nettoyage final */
@@ -212,9 +211,8 @@ bool annotate_dex_code_item(const GDexFormat *format, uleb128_t offset)
/******************************************************************************
* *
-* Paramètres : format = description de l'exécutable à compléter. *
-* pos = tête de lecture pour les symboles. *
-* handlers = position de départ pour les gestionnaires. *
+* Paramètres : format = description de l'exécutable à compléter. *
+* pos = tête de lecture pour les symboles. *
* *
* Description : Commente les définitions d'une protection contre exceptions. *
* *
@@ -224,7 +222,7 @@ bool annotate_dex_code_item(const GDexFormat *format, uleb128_t offset)
* *
******************************************************************************/
-static bool annotate_dex_try_item(const GDexFormat *format, vmpa2t *pos, const vmpa2t *handlers)
+static bool annotate_dex_try_item(const GDexFormat *format, vmpa2t *pos)
{
bool result; /* Bilan à retourner */
GBinContent *content; /* Contenu binaire à lire */
@@ -235,8 +233,8 @@ static bool annotate_dex_try_item(const GDexFormat *format, vmpa2t *pos, const v
GDbComment *comment; /* Définition de commentaire */
GBinSymbol *symbol; /* Symbole à intégrer */
char *text; /* Texte constant à insérer */
- uint16_t handler_off; /* Décallage à appliquer */
- vmpa2t handler; /* Lecture à poursuivre */
+
+ result = true;
content = g_binary_format_get_content(G_BIN_FORMAT(format));
@@ -283,13 +281,6 @@ static bool annotate_dex_try_item(const GDexFormat *format, vmpa2t *pos, const v
free(text);
- g_imm_operand_get_value(G_IMM_OPERAND(operand), MDS_16_BITS, &handler_off);
-
- copy_vmpa(&handler, handlers);
- advance_vmpa(&handler, handler_off);
-
- result = annotate_dex_encoded_catch_handler_list(format, &handler);
-
/* Nettoyage final */
g_object_unref(G_OBJECT(content));
@@ -392,7 +383,7 @@ static bool annotate_dex_encoded_catch_handler(const GDexFormat *format, vmpa2t
/* size */
copy_vmpa(&start, pos);
- instr = g_raw_instruction_new_uleb128(content, pos);
+ instr = g_raw_instruction_new_sleb128(content, pos);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);