diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/format/dex/dex-int.c | 8 |
2 files changed, 12 insertions, 1 deletions
@@ -1,5 +1,10 @@ 16-09-11 Cyrille Bagard <nocbos@gmail.com> + * src/format/dex/dex-int.c: + Fix a bug when decoding some catch-all handlers in Dex code item. + +16-09-11 Cyrille Bagard <nocbos@gmail.com> + * plugins/androhelpers/try_n_catch.c: * plugins/readdex/class.c: Update code. 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++) |