2008-05-07 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Wed, 7 May 2008 13:48:00 +0000 (13:48 -0000)
committerZoltan Varga <vargaz@gmail.com>
Wed, 7 May 2008 13:48:00 +0000 (13:48 -0000)
* mini.c (mini_get_method): Check whenever the method class is an open generic
type, and return NULL in that case, causing a verification error. Fixes
#384123.

svn path=/trunk/mono/; revision=102726

mono/mini/ChangeLog
mono/mini/mini.c

index fedebc6a8b843aa6bf9d7a9d74c07fe8cfd732b2..ee5f7f92b829d9dfd2f371b83168d9a0a16d2ee6 100644 (file)
@@ -1,3 +1,9 @@
+2008-05-07  Zoltan Varga  <vargaz@gmail.com>
+
+       * mini.c (mini_get_method): Check whenever the method class is an open generic
+       type, and return NULL in that case, causing a verification error. Fixes
+       #384123.
+
 2008-05-06  Rodrigo Kumpera  <rkumpera@novell.com>
 
        * driver.c (mono_main): Revert r102623. The right
index bf8c1e278665d6f23bd7986c4912b7bfe799e1ea..274031ea1143bd63007349776b19e698eacba697 100644 (file)
@@ -4152,7 +4152,7 @@ emit_tree (MonoCompile *cfg, MonoBasicBlock *bblock, MonoInst *ins, const guint8
 }
 
 static inline MonoMethod *
-mini_get_method (MonoMethod *m, guint32 token, MonoClass *klass, MonoGenericContext *context)
+mini_get_method_allow_open (MonoMethod *m, guint32 token, MonoClass *klass, MonoGenericContext *context)
 {
        MonoMethod *method;
 
@@ -4164,6 +4164,17 @@ mini_get_method (MonoMethod *m, guint32 token, MonoClass *klass, MonoGenericCont
        return method;
 }
 
+static inline MonoMethod *
+mini_get_method (MonoMethod *m, guint32 token, MonoClass *klass, MonoGenericContext *context)
+{
+       MonoMethod *method = mini_get_method_allow_open (m, token, klass, context);
+
+       if (method && mono_class_is_open_constructed_type (&method->klass->byval_arg))
+               return NULL;
+
+       return method;
+}
+
 static inline MonoClass*
 mini_get_class (MonoMethod *method, guint32 token, MonoGenericContext *context)
 {
@@ -5396,7 +5407,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                if (!dont_verify && !cfg->skip_visibility) {
                                        MonoMethod *target_method = cil_method;
                                        if (method->is_inflated) {
-                                               target_method = mini_get_method (method, token, NULL, &method_definition->generic_container->context);
+                                               target_method = mini_get_method_allow_open (method, token, NULL, &method_definition->generic_container->context);
                                        }
                                        if (!mono_method_can_access_method (method_definition, target_method) &&
                                                !mono_method_can_access_method (method, cil_method))