diff options
Diffstat (limited to 'plugins/dalvik/context.c')
-rw-r--r-- | plugins/dalvik/context.c | 18 |
1 files changed, 13 insertions, 5 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; } |