diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-01-30 00:21:08 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-01-30 00:21:08 (GMT) |
commit | c922b6b9c841a97dd948755658cff07b2c6762ff (patch) | |
tree | 7236b03fde56edde625e406085862381cde6e955 /src/arch/dalvik/operands/target.c | |
parent | 16e0fd9d89ef433848678dfc8dd20426844a2868 (diff) |
Updated some parts of the code dealing with Dalvik.
Diffstat (limited to 'src/arch/dalvik/operands/target.c')
-rw-r--r-- | src/arch/dalvik/operands/target.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/arch/dalvik/operands/target.c b/src/arch/dalvik/operands/target.c index 690858b..42d09cf 100644 --- a/src/arch/dalvik/operands/target.c +++ b/src/arch/dalvik/operands/target.c @@ -155,12 +155,11 @@ static void g_dalvik_target_operand_finalize(GDalvikTargetOperand *operand) /****************************************************************************** * * -* Paramètres : data = flux de données à analyser. * -* pos = position courante dans ce flux. [OUT] * -* end = limite des données à analyser. * -* size = taille de l'opérande. * -* endian = ordre des bits dans la source. * -* base = adresse de référence pour le calcul. * +* Paramètres : content = flux de données à analyser. * +* pos = position courante dans ce flux. [OUT] * +* size = taille de l'opérande. * +* endian = ordre des bits dans la source. * +* base = adresse de référence pour le calcul. * * * * Description : Crée un opérande visant un instruction Dalvik. * * * @@ -170,26 +169,27 @@ static void g_dalvik_target_operand_finalize(GDalvikTargetOperand *operand) * * ******************************************************************************/ -GArchOperand *g_dalvik_target_operand_new(const bin_t *data, off_t *pos, off_t end, MemoryDataSize size, SourceEndian endian, vmpa_t base) +GArchOperand *g_dalvik_target_operand_new(const GBinContent *content, vmpa2t *pos, MemoryDataSize size, SourceEndian endian, vmpa_t base) { GDalvikTargetOperand *result; /* Structure à retourner */ int8_t val8; /* Valeur sur 8 bits */ int16_t val16; /* Valeur sur 16 bits */ int32_t val32; /* Valeur sur 32 bits */ + bool test; /* Bilan de lecture */ vmpa_t address; /* Adresse finale visée */ switch (size) { case MDS_8_BITS_SIGNED: - read_s8(&val8, data, pos, end); + test = g_binary_content_read_s8(content, pos, &val8); address = base + val8 * sizeof(uint16_t); break; case MDS_16_BITS_SIGNED: - read_s16(&val16, data, pos, end, endian); + test = g_binary_content_read_s16(content, pos, endian, &val16); address = base + val16 * sizeof(uint16_t); break; case MDS_32_BITS_SIGNED: - read_s32(&val32, data, pos, end, endian); + test = g_binary_content_read_s32(content, pos, endian, &val32); address = base + val32 * sizeof(uint16_t); break; default: @@ -197,6 +197,9 @@ GArchOperand *g_dalvik_target_operand_new(const bin_t *data, off_t *pos, off_t e break; } + if (!test) + return NULL; + result = g_object_new(G_TYPE_DALVIK_TARGET_OPERAND, NULL); result->immediate = G_IMM_OPERAND(g_imm_operand_new_from_value(MDS_32_BITS/*FIXME*/, (uint32_t)address/* FIXME */)); |