From 1b3887c5609831bc2aee2f00f6a4d31d7406a225 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Mon, 27 Jan 2020 00:40:07 +0100
Subject: Checked index for access to Dex class methods.

---
 plugins/dex/class.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/plugins/dex/class.c b/plugins/dex/class.c
index 9defac7..dafa984 100644
--- a/plugins/dex/class.c
+++ b/plugins/dex/class.c
@@ -636,9 +636,19 @@ GDexMethod *g_dex_class_get_method(const GDexClass *class, bool virtual, size_t
     GDexMethod *result;                     /* Instance à renvoyer         */
 
     if (virtual)
-        result = class->virtual_methods[index];
+    {
+        if (index < class->vmethods_count)
+            result = class->virtual_methods[index];
+        else
+            result = NULL;
+    }
     else
-        result = class->direct_methods[index];
+    {
+        if (index < class->dmethods_count)
+            result = class->direct_methods[index];
+        else
+            result = NULL;
+    }
 
     if (result != NULL)
         g_object_ref(G_OBJECT(result));
-- 
cgit v0.11.2-87-g4458