2010-06-29 Rodrigo Kumpera <rkumpera@novell.com>
authorRodrigo Kumpera <kumpera@gmail.com>
Tue, 29 Jun 2010 20:56:20 +0000 (20:56 -0000)
committerRodrigo Kumpera <kumpera@gmail.com>
Tue, 29 Jun 2010 20:56:20 +0000 (20:56 -0000)
* icall.c (ves_icall_Type_make_array_type): Raise a TLE if a
TypedByRef is passed.

* icall.c (ves_icall_Type_make_byref_type): Ditto.

* icall.c (ves_icall_Type_MakePointerType): Ditto.

Fixes #612780.

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

mono/metadata/ChangeLog
mono/metadata/icall.c

index 5f9643f9ece5b8dd1be6051fc55f227fa534028a..2ec21eefed132f958066cacf9fd47e7c19e66095 100644 (file)
@@ -1,3 +1,14 @@
+2010-06-29 Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * icall.c (ves_icall_Type_make_array_type): Raise a TLE if a
+       TypedByRef is passed.
+
+       * icall.c (ves_icall_Type_make_byref_type): Ditto.
+
+       * icall.c (ves_icall_Type_MakePointerType): Ditto.
+
+       Fixes #612780.
+
 2010-06-29 Rodrigo Kumpera  <rkumpera@novell.com>
 
        * assembly.c: Add a few more assemblies to the list of framework
index 6c7154370155a60136909ed5f1372f759299c16a..24c8accbc41618ed943ff799b18feea554d1afec 100644 (file)
@@ -5712,6 +5712,20 @@ ves_icall_Type_IsArrayImpl (MonoReflectionType *t)
        return res;
 }
 
+static void
+check_for_invalid_type (MonoClass *klass)
+{
+       char *name;
+       MonoString *str;
+       if (klass->byval_arg.type != MONO_TYPE_TYPEDBYREF)
+               return;
+
+       name = mono_type_get_full_name (klass);
+       str =  mono_string_new (mono_domain_get (), name);
+       g_free (name);
+       mono_raise_exception ((MonoException*)mono_get_exception_type_load (str, NULL));
+
+}
 static MonoReflectionType *
 ves_icall_Type_make_array_type (MonoReflectionType *type, int rank)
 {
@@ -5721,6 +5735,7 @@ ves_icall_Type_make_array_type (MonoReflectionType *type, int rank)
 
        klass = mono_class_from_mono_type (type->type);
        mono_class_init_or_throw (klass);
+       check_for_invalid_type (klass);
 
        if (rank == 0) //single dimentional array
                aklass = mono_array_class_get (klass, 1);
@@ -5739,6 +5754,7 @@ ves_icall_Type_make_byref_type (MonoReflectionType *type)
 
        klass = mono_class_from_mono_type (type->type);
        mono_class_init_or_throw (klass);
+       check_for_invalid_type (klass);
 
        return mono_type_get_object (mono_object_domain (type), &klass->this_arg);
 }
@@ -5746,9 +5762,11 @@ ves_icall_Type_make_byref_type (MonoReflectionType *type)
 static MonoReflectionType *
 ves_icall_Type_MakePointerType (MonoReflectionType *type)
 {
-       MonoClass *pklass;
+       MonoClass *klass, *pklass;
 
-       mono_class_init_or_throw (mono_class_from_mono_type (type->type));
+       klass = mono_class_from_mono_type (type->type);
+       mono_class_init_or_throw (klass);
+       check_for_invalid_type (klass);
 
        pklass = mono_ptr_class_get (type->type);