2008-04-24 Rodrigo Kumpera <rkumpera@novell.com>
authorRodrigo Kumpera <kumpera@gmail.com>
Thu, 24 Apr 2008 18:17:09 +0000 (18:17 -0000)
committerRodrigo Kumpera <kumpera@gmail.com>
Thu, 24 Apr 2008 18:17:09 +0000 (18:17 -0000)
* verify.c (verify_class_for_overlapping_reference_fields):
If class is under fulltrust allow reference types to overllap
if they have the same RVA.

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

mono/metadata/ChangeLog
mono/metadata/verify.c

index cdb0bbc4df02814edfab9c1c22043fae388175e3..52917752a1d445a9739a023a9542fe2927951d77 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-24 Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * verify.c (verify_class_for_overlapping_reference_fields): 
+       If class is under fulltrust allow reference types to overllap
+       if they have the same RVA.
+
 2008-04-24 Rodrigo Kumpera  <rkumpera@novell.com>
 
        * pedump.c: Added new flag valid-only, that makes the verifier
index 33d668167cc63d4a6d8efe01a630f2c4300f3d70..9a9c087ee554e6f12050a9ab3999d416186bc53d 100644 (file)
@@ -5381,6 +5381,7 @@ static gboolean
 verify_class_for_overlapping_reference_fields (MonoClass *class)
 {
        int i, j, align;
+       gboolean is_fulltrust = mono_verifier_is_class_full_trust (class);
        if (!(class->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT || !class->has_references)
                return TRUE;
                
@@ -5397,6 +5398,10 @@ verify_class_for_overlapping_reference_fields (MonoClass *class)
                        int otherEnd = other->offset + mono_type_size (other->type, &align);
                        if (mono_field_is_deleted (other) || (is_valuetype && !MONO_TYPE_IS_REFERENCE (other->type)) || (other->type->attrs & FIELD_ATTRIBUTE_STATIC))
                                continue;
+
+                       if (!is_valuetype && MONO_TYPE_IS_REFERENCE (other->type) && field->offset == other->offset && is_fulltrust)
+                               continue;
+
                        if ((otherEnd > field->offset && otherEnd <= fieldEnd) || (other->offset >= field->offset && other->offset < fieldEnd))
                                return FALSE;
                }