Author: lupus
Date: 2007-10-11 11:50:51 -0400 (Thu, 11 Oct 2007)
New Revision: 87338

Modified:
   trunk/mono/mono/mini/ChangeLog
   trunk/mono/mono/mini/exceptions-x86.c
Log:


Thu Oct 11 18:04:29 CEST 2007 Paolo Molaro <[EMAIL PROTECTED]>

        * exceptions-x86.c: provide more graceful handling of the case where
        we followed a bogus function pointer from managed code (bug #332866).



Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog      2007-10-11 15:43:00 UTC (rev 87337)
+++ trunk/mono/mono/mini/ChangeLog      2007-10-11 15:50:51 UTC (rev 87338)
@@ -1,3 +1,9 @@
+
+Thu Oct 11 18:04:29 CEST 2007 Paolo Molaro <[EMAIL PROTECTED]>
+
+       * exceptions-x86.c: provide more graceful handling of the case where
+       we followed a bogus function pointer from managed code (bug #332866).
+
 2007-10-11  Mark Probst  <[EMAIL PROTECTED]>
 
        * mini.h, mini.c: Introduced the MonoGenericSharingContext, which

Modified: trunk/mono/mono/mini/exceptions-x86.c
===================================================================
--- trunk/mono/mono/mini/exceptions-x86.c       2007-10-11 15:43:00 UTC (rev 
87337)
+++ trunk/mono/mono/mini/exceptions-x86.c       2007-10-11 15:50:51 UTC (rev 
87338)
@@ -838,6 +838,16 @@
        gpointer *sp;
        int frame_size;
 
+       /* if we didn't find a managed method for the ip address and it matches 
the fault
+        * address, we assume we followed a broken pointer during an indirect 
call, so
+        * we try the lookup again with the return address pushed on the stack
+        */
+       if (!ji && fault_addr == (gpointer)UCONTEXT_REG_EIP (ctx)) {
+               glong *sp = (gpointer)UCONTEXT_REG_ESP (ctx);
+               ji = mono_jit_info_table_find (mono_domain_get (), (gpointer)sp 
[0]);
+               if (ji)
+                       UCONTEXT_REG_EIP (ctx) = sp [0];
+       }
        if (stack_ovf)
                exc = mono_domain_get ()->stack_overflow_ex;
        if (!ji)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to