2009-05-11 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Tue, 12 May 2009 01:54:15 +0000 (01:54 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Tue, 12 May 2009 01:54:15 +0000 (01:54 -0000)
* security-core-clr.c: Delegate checks are done at creation time,
not a invocation time. Fix exception for Telerik Silverlight demo

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

mono/metadata/ChangeLog
mono/metadata/security-core-clr.c

index 1f4540bd386eb933da27f76c7df8270fa0618d53..592bb61225ea82bfccf6ec5585b20021824152bf 100644 (file)
@@ -1,3 +1,8 @@
+2009-05-11  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * security-core-clr.c: Delegate checks are done at creation time,
+       not a invocation time. Fix exception for Telerik Silverlight demo
+
 2009-05-11  Mark Probst  <mark.probst@gmail.com>
 
        * sgen-gc.c (need_remove_object_for_domain): Remove the special
index d67d5fb0c504126e491ad41663bab98bd76467d0..59b5a7c11561cc910ee121b211eb9879c83703c1 100644 (file)
@@ -152,12 +152,17 @@ get_caller_no_reflection_related (MonoMethod *m, gint32 no, gint32 ilo, gboolean
        /* calls from System.Delegate are also possible and allowed */
        if (strcmp (ns, "System") == 0) {
                const char *kname = m->klass->name;
-               if ((*kname == 'D') && (strcmp (kname, "Delegate") == 0))
-                       return FALSE;
-               if ((*kname == 'M') && (strcmp (kname, "MulticastDelegate")) == 0)
-                       return FALSE;
                if ((*kname == 'A') && (strcmp (kname, "Activator") == 0))
                        return FALSE;
+
+               // the security check on the delegate is made at creation time, not at invoke time
+               if (((*kname == 'D') && (strcmp (kname, "Delegate") == 0)) || 
+                       ((*kname == 'M') && (strcmp (kname, "MulticastDelegate")) == 0)) {
+
+                       // if we're invoking then we can stop our stack walk
+                       if (strcmp (m->name, "DynamicInvoke") != 0)
+                               return FALSE;
+               }
        }
 
        if (m == *dest) {