Handle cattr with arrays of System.Type.
authorRodrigo Kumpera <kumpera@gmail.com>
Mon, 22 Nov 2010 03:04:14 +0000 (01:04 -0200)
committerRodrigo Kumpera <kumpera@gmail.com>
Mon, 22 Nov 2010 03:07:57 +0000 (01:07 -0200)
* metadata-verify.c (is_valid_fixed_param): Handle arrays
of types. They can be encoded as 0x1B or 0x50.

* metadata-verify.c (is_valid_cattr_content): Ditto.

Fixes #655159

mono/metadata/metadata-verify.c

index a3f61a813a613c751f161a5f0de85d348d583f6d..484e28bbdd5bcfbb737e183de8decd2ee468e67c 100644 (file)
@@ -1856,6 +1856,8 @@ handle_enum:
                                klass = get_enum_by_encoded_name (ctx, &ptr, end);
                                if (!klass)
                                        return FALSE;
+                       } else if (etype == 0x50 || etype == MONO_TYPE_CLASS) {
+                               klass = mono_defaults.systemtype_class;
                        } else if ((etype >= MONO_TYPE_BOOLEAN && etype <= MONO_TYPE_STRING) || etype == 0x51) {
                                simple_type.type = etype == 0x51 ? MONO_TYPE_OBJECT : etype;
                                klass = mono_class_from_mono_type (&simple_type);
@@ -1983,6 +1985,8 @@ is_valid_cattr_content (VerifyContext *ctx, MonoMethod *ctor, const char *ptr, g
                                klass = get_enum_by_encoded_name (ctx, &ptr, end);
                                if (!klass)
                                        return FALSE;
+                       } else if (etype == 0x50 || etype == MONO_TYPE_CLASS) {
+                               klass = mono_defaults.systemtype_class;
                        } else if ((etype >= MONO_TYPE_BOOLEAN && etype <= MONO_TYPE_STRING) || etype == 0x51) {
                                simple_type.type = etype == 0x51 ? MONO_TYPE_OBJECT : etype;
                                klass = mono_class_from_mono_type (&simple_type);