summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-09-11 18:31:34 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-09-11 18:31:34 (GMT)
commitfe39a487b4db5564036a436bfcb7cf3561889fb5 (patch)
tree99f9ceeea2eecbc3aaf7c2ce8fb226b700cb4dbf /src
parent29f3cf8c660c5ce51dbcdbd0c770a1d9831cf1a8 (diff)
Fixed a bug when decoding some catch-all handlers in Dex code item.
Diffstat (limited to 'src')
-rw-r--r--src/format/dex/dex-int.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/format/dex/dex-int.c b/src/format/dex/dex-int.c
index 79cdc57..b746f4d 100644
--- a/src/format/dex/dex-int.c
+++ b/src/format/dex/dex-int.c
@@ -24,6 +24,7 @@
#include "dex-int.h"
+#include <assert.h>
#include <malloc.h>
@@ -634,7 +635,7 @@ bool read_dex_encoded_catch_handler(const GDexFormat *format, vmpa2t *pos, encod
}
else handler->handlers = NULL;
- if (handler->size < 0)
+ if (handler->size <= 0)
result &= g_binary_content_read_uleb128(content, pos, &handler->catch_all_addr);
else
@@ -808,10 +809,15 @@ bool read_dex_code_item(const GDexFormat *format, vmpa2t *pos, code_item *item)
/* Padding ? */
if (item->tries_size > 0 && item->insns_size % 2 == 1)
+ {
result &= g_binary_content_read_u16(content, pos, SRE_LITTLE, &padding);
+ assert(padding == 0);
+ }
if (item->tries_size > 0 && result)
{
+ assert(get_phy_addr(pos) % 4 == 0);
+
item->tries = (try_item *)calloc(item->tries_size, sizeof(try_item));
for (i = 0; i < item->tries_size && result; i++)