Author: lupus
Date: 2006-02-20 04:38:29 -0500 (Mon, 20 Feb 2006)
New Revision: 57060

Modified:
   trunk/mono/mono/mini/ChangeLog
   trunk/mono/mono/mini/mini.c
Log:


Mon Feb 20 10:37:57 CET 2006 Paolo Molaro <[EMAIL PROTECTED]>

        * mini.c: more verification checks.



Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog      2006-02-19 22:44:43 UTC (rev 57059)
+++ trunk/mono/mono/mini/ChangeLog      2006-02-20 09:38:29 UTC (rev 57060)
@@ -1,4 +1,8 @@
 
+Mon Feb 20 10:37:57 CET 2006 Paolo Molaro <[EMAIL PROTECTED]>
+
+       * mini.c: more verification checks.
+
 Fri Feb 17 19:47:29 CET 2006 Paolo Molaro <[EMAIL PROTECTED]>
 
        * mini.c: added a few more verification checks.

Modified: trunk/mono/mono/mini/mini.c
===================================================================
--- trunk/mono/mono/mini/mini.c 2006-02-19 22:44:43 UTC (rev 57059)
+++ trunk/mono/mono/mini/mini.c 2006-02-20 09:38:29 UTC (rev 57060)
@@ -1202,14 +1202,15 @@
 
 static const char
 bin_comp_table [STACK_MAX] [STACK_MAX] = {
+/*     Inv i  L  p  F  &  O  vt */
        {0},
-       {0, 1, 0, 1, 0, 0, 4, 0},
-       {0, 0, 1, 0, 0, 0, 0, 0},
-       {0, 1, 0, 1, 0, 2, 4, 0},
-       {0, 0, 0, 0, 1, 0, 0, 0},
-       {0, 0, 0, 2, 0, 1, 0, 0},
-       {0, 4, 0, 4, 0, 0, 3, 0},
-       {0, 0, 0, 0, 0, 0, 0, 0},
+       {0, 1, 0, 1, 0, 0, 0, 0}, /* i, int32 */
+       {0, 0, 1, 0, 0, 0, 0, 0}, /* L, int64 */
+       {0, 1, 0, 1, 0, 2, 4, 0}, /* p, ptr */
+       {0, 0, 0, 0, 1, 0, 0, 0}, /* F, R8 */
+       {0, 0, 0, 2, 0, 1, 0, 0}, /* &, managed pointer */
+       {0, 0, 0, 4, 0, 0, 3, 0}, /* O, reference */
+       {0, 0, 0, 0, 0, 0, 0, 0}, /* vt value type */
 };
 
 /* reduce the size of this table */
@@ -5353,8 +5354,10 @@
                                CHECK_STACK (1);
                                --sp;
                        }
-                       if (sp [0]->type == STACK_I4 || sp [0]->type == 
STACK_I8 || sp [0]->type == STACK_R8 || sp [0]->type == STACK_VTYPE)
+                       if (sp [0]->type == STACK_I4 || sp [0]->type == 
STACK_I8 || sp [0]->type == STACK_R8)
                                goto unverified;
+                       if (*ip != CEE_LDFLD && sp [0]->type == STACK_VTYPE)
+                               goto unverified;
                        CHECK_OPSIZE (5);
                        token = read32 (ip + 1);
                        if (method->wrapper_type != MONO_WRAPPER_NONE) {
@@ -5802,9 +5805,11 @@
                        break;
                case CEE_LDLEN:
                        CHECK_STACK (1);
+                       --sp;
+                       if (sp [0]->type != STACK_OBJ)
+                               goto unverified;
                        MONO_INST_NEW (cfg, ins, *ip);
                        ins->cil_code = ip++;
-                       --sp;
                        ins->inst_left = *sp;
                        ins->type = STACK_PTR;
                        *sp++ = ins;
@@ -5813,6 +5818,8 @@
                        CHECK_STACK (2);
                        sp -= 2;
                        CHECK_OPSIZE (5);
+                       if (sp [0]->type != STACK_OBJ)
+                               goto unverified;
 
                        klass = mini_get_class (method, read32 (ip + 1), 
generic_context);
                        if (!klass)
@@ -5841,6 +5848,8 @@
                        MonoInst *load;
                        CHECK_STACK (2);
                        sp -= 2;
+                       if (sp [0]->type != STACK_OBJ)
+                               goto unverified;
                        CHECK_OPSIZE (5);
                        token = read32 (ip + 1);
                        klass = mono_class_get_full (image, token, 
generic_context);
@@ -5876,6 +5885,8 @@
                         */
                        CHECK_STACK (2);
                        sp -= 2;
+                       if (sp [0]->type != STACK_OBJ)
+                               goto unverified;
                        klass = array_access_to_klass (*ip);
                        NEW_LDELEMA (cfg, load, sp, klass);
                        load->cil_code = ip;
@@ -5902,6 +5913,8 @@
                         */
                        CHECK_STACK (3);
                        sp -= 3;
+                       if (sp [0]->type != STACK_OBJ)
+                               goto unverified;
                        klass = array_access_to_klass (*ip);
                        NEW_LDELEMA (cfg, load, sp, klass);
                        load->cil_code = ip;
@@ -5924,6 +5937,8 @@
                         */
                        CHECK_STACK (3);
                        sp -= 3;
+                       if (sp [0]->type != STACK_OBJ)
+                               goto unverified;
                        CHECK_OPSIZE (5);
                        token = read32 (ip + 1);
                        klass = mono_class_get_full (image, token, 
generic_context);
@@ -5966,6 +5981,10 @@
 
                        CHECK_STACK (3);
                        sp -= 3;
+                       if (sp [0]->type != STACK_OBJ)
+                               goto unverified;
+                       if (sp [2]->type != STACK_OBJ)
+                               goto unverified;
 
                        handle_loaded_temps (cfg, bblock, stack_start, sp);
 

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

Reply via email to