[metadata] Fix a potential crasher.
[mono.git] / mono / metadata / debug-helpers.c
index 1cf21e31b702c20ca165a913ad217e7c8ce2a745..a20e8ae06e03a9ade8d5e64419f4d0a4b9122220 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * console-io.c: ConsoleDriver internal calls
+ * debug-helpers.c:
  *
  * Author:
  *     Mono Project (http://www.mono-project.com)
@@ -326,10 +326,10 @@ mono_method_desc_new (const char *name, gboolean include_namespace)
                g_free (class_nspace);
                return NULL;
        }
-       *method_name++ = 0;
        /* allow two :: to separate the method name */
-       if (*method_name == ':')
-               method_name++;
+       if (method_name != class_nspace && method_name [-1] == ':')
+               method_name [-1] = 0;
+       *method_name++ = 0;
        class_name = strrchr (class_nspace, '.');
        if (class_name) {
                *class_name++ = 0;
@@ -468,6 +468,8 @@ match_class (MonoMethodDesc *desc, int pos, MonoClass *klass)
 gboolean
 mono_method_desc_full_match (MonoMethodDesc *desc, MonoMethod *method)
 {
+       if (!desc->klass)
+               return FALSE;
        if (!match_class (desc, strlen (desc->klass), method->klass))
                return FALSE;
 
@@ -1003,7 +1005,7 @@ mono_class_describe_statics (MonoClass* klass)
 
        if (!vtable)
                return;
-       if (!(addr = vtable->data))
+       if (!(addr = mono_vtable_get_static_field_data (vtable)))
                return;
 
        for (p = klass; p != NULL; p = p->parent) {
@@ -1020,4 +1022,3 @@ mono_class_describe_statics (MonoClass* klass)
                }
        }
 }
-