summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-06-20 20:31:34 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-06-20 20:31:34 (GMT)
commit4f367c98d76b8eab6adff5d9e6e43fbe74d1259c (patch)
tree4b3ff63dad50d4dc829c80d536bc104433cdf4d0
parent96e3c4558ea9f37e810afa8c1155573891a88973 (diff)
Fixed the length and the rendering of Dalvik data arrays.
-rw-r--r--plugins/dalvik/context.c18
-rw-r--r--plugins/dalvik/v35/processor.c4
2 files changed, 13 insertions, 9 deletions
diff --git a/plugins/dalvik/context.c b/plugins/dalvik/context.c
index 8eb600d..752e831 100644
--- a/plugins/dalvik/context.c
+++ b/plugins/dalvik/context.c
@@ -24,6 +24,7 @@
#include "context.h"
+#include <assert.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
@@ -341,6 +342,8 @@ bool g_dalvik_context_register_array_data(GDalvikContext *ctx, const vmpa2t *sta
if (result)
{
+ assert(length % width == 0);
+
new.item_len = width;
new.padding = false;
@@ -424,6 +427,8 @@ GArchInstruction *g_dalvik_context_get_raw_data(GDalvikContext *ctx, const GBinC
GArchInstruction *result; /* Instruction à retourner */
raw_data_area *found; /* Zone de couverture trouvée */
GBinContent *restricted; /* Zone de lecture effective */
+ phys_t length; /* Zone de couverture */
+ size_t count; /* Nombre d'éléments */
result = NULL;
@@ -436,27 +441,30 @@ GArchInstruction *g_dalvik_context_get_raw_data(GDalvikContext *ctx, const GBinC
{
restricted = g_restricted_content_new_ro(content, &found->range);
+ length = get_mrange_length(&found->range);
+ count = length / found->item_len;
+
switch (found->item_len)
{
case 1:
- result = g_raw_instruction_new_array(restricted, MDS_8_BITS_UNSIGNED, 1, pos, SRE_LITTLE);
+ result = g_raw_instruction_new_array(restricted, MDS_8_BITS_UNSIGNED, count, pos, SRE_LITTLE);
break;
case 2:
- result = g_raw_instruction_new_array(restricted, MDS_16_BITS_UNSIGNED, 1, pos, SRE_LITTLE);
+ result = g_raw_instruction_new_array(restricted, MDS_16_BITS_UNSIGNED, count, pos, SRE_LITTLE);
break;
case 4:
- result = g_raw_instruction_new_array(restricted, MDS_32_BITS_UNSIGNED, 1, pos, SRE_LITTLE);
+ result = g_raw_instruction_new_array(restricted, MDS_32_BITS_UNSIGNED, count, pos, SRE_LITTLE);
break;
case 8:
- result = g_raw_instruction_new_array(restricted, MDS_64_BITS_UNSIGNED, 1, pos, SRE_LITTLE);
+ result = g_raw_instruction_new_array(restricted, MDS_64_BITS_UNSIGNED, count, pos, SRE_LITTLE);
break;
default:
result = g_raw_instruction_new_array(restricted, MDS_8_BITS_UNSIGNED,
- found->item_len, pos, SRE_LITTLE);
+ length, pos, SRE_LITTLE);
break;
}
diff --git a/plugins/dalvik/v35/processor.c b/plugins/dalvik/v35/processor.c
index 19141e5..b1c13d2 100644
--- a/plugins/dalvik/v35/processor.c
+++ b/plugins/dalvik/v35/processor.c
@@ -465,10 +465,6 @@ static GArchInstruction *g_dalvik35_processor_disassemble(const GArchProcessor *
};
- vmpa2t ttmp;
-
- copy_vmpa(&ttmp, pos);
-
/* Données brutes associées à une instruction ? */
result = g_dalvik_context_get_raw_data(ctx, content, pos);