Author: kumpera
Date: 2007-12-20 07:40:56 -0500 (Thu, 20 Dec 2007)
New Revision: 91698
Modified:
trunk/mono/mono/metadata/ChangeLog
trunk/mono/mono/metadata/verify.c
Log:
2007-12-20 Rodrigo Kumpera <[EMAIL PROTECTED]>
* verify.c (init_stack_with_value): added
* verify.c (mono_method_verify): extracted common
code for exception initialization into init_stack_with_value.
* verify.c (mono_method_verify): initialize the exception
for handler clauses as well.
* verify.c (mono_method_verify): fix the exception clause
ordering rules, it should use handler end offset and not
start offset.
Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog 2007-12-20 12:37:27 UTC (rev 91697)
+++ trunk/mono/mono/metadata/ChangeLog 2007-12-20 12:40:56 UTC (rev 91698)
@@ -1,4 +1,17 @@
+2007-12-20 Rodrigo Kumpera <[EMAIL PROTECTED]>
+ * verify.c (init_stack_with_value): added
+
+ * verify.c (mono_method_verify): extracted common
+ code for exception initialization into init_stack_with_value.
+
+ * verify.c (mono_method_verify): initialize the exception
+ for handler clauses as well.
+
+ * verify.c (mono_method_verify): fix the exception clause
+ ordering rules, it should use handler end offset and not
+ start offset.
+
Thu Dec 20 12:27:24 CET 2007 Paolo Molaro <[EMAIL PROTECTED]>
* rawbuffer.c: remove useless warning.
Modified: trunk/mono/mono/metadata/verify.c
===================================================================
--- trunk/mono/mono/metadata/verify.c 2007-12-20 12:37:27 UTC (rev 91697)
+++ trunk/mono/mono/metadata/verify.c 2007-12-20 12:40:56 UTC (rev 91698)
@@ -1804,6 +1804,17 @@
return;
}
+/* Initialize a stack and push a given type.
+ */
+static void
+init_stack_with_value (VerifyContext *ctx, ILCodeDesc *code, MonoClass *klass)
+{
+ stack_init (ctx, code);
+ set_stack_value (code->stack, &klass->byval_arg, FALSE);
+ code->size = 1;
+ code->flags = IL_CODE_FLAG_SEEN;
+}
+
/* Generics validation stuff, should be moved to another metadata/? file */
static gboolean
mono_is_generic_type_compatible (MonoType *target, MonoType *candidate)
@@ -3312,7 +3323,7 @@
if (clause->handler_len <= 0)
ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("try clause
len <= 0 at 0x%04x", clause->try_offset));
- if (i && clause->handler_offset < handler_start)
+ if (i && clause->handler_offset + clause->handler_len <
handler_start)
ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("exception
handler are in the wrong order, 0x%04x > 0x%04x", handler_start,
clause->handler_offset));
if (clause->try_offset < clause->handler_offset &&
clause->try_offset + clause->try_len > clause->handler_offset)
@@ -3325,26 +3336,17 @@
ADD_VERIFY_ERROR (&ctx, g_strdup_printf
("filter clause contains a try starting at 0x%04x", inner->try_offset));
}
}
- handler_start = clause->handler_offset;
+ handler_start = clause->handler_offset + clause->handler_len;
if (!ctx.valid)
break;
if (clause->flags == MONO_EXCEPTION_CLAUSE_NONE) {
- ILCodeDesc *code = ctx.code + clause->handler_offset;
- stack_init (&ctx, code);
- code->stack [0].stype = TYPE_COMPLEX;
- code->stack [0].type =
&clause->data.catch_class->byval_arg;
- code->size = 1;
- code->flags = IL_CODE_FLAG_SEEN;
+ init_stack_with_value (&ctx, ctx.code +
clause->handler_offset, clause->data.catch_class);
}
else if (clause->flags == MONO_EXCEPTION_CLAUSE_FILTER) {
- ILCodeDesc *code = ctx.code +
clause->data.filter_offset;
- stack_init (&ctx, code);
- code->stack [0].stype = TYPE_COMPLEX;
- code->stack [0].type =
&mono_defaults.exception_class->byval_arg;
- code->size = 1;
- code->flags = IL_CODE_FLAG_SEEN;
+ init_stack_with_value (&ctx, ctx.code +
clause->data.filter_offset, mono_defaults.exception_class);
+ init_stack_with_value (&ctx, ctx.code +
clause->handler_offset, mono_defaults.exception_class);
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches