Skip to content

Commit

Permalink
Backport from trunk
Browse files Browse the repository at this point in the history
009-12-14  Miguel de Icaza  <miguel@novell.com>

	* method-to-ir.c (mono_method_to_ir): CEE_UNUSUED opcodes now
	raise an invalid program exception.   

	For other opcodes that we might not handle use a g_warning and
	raise the exception.   Beats termination.

	Fixes #561724

2009-12-14  Miguel de Icaza  <miguel@novell.com>

	* verify.c (mono_method_verify): The Unused opcodes produce an
	InvalidProgramException on .NET




svn path=/branches/mono-2-6/mono/; revision=148418
  • Loading branch information
migueldeicaza committed Dec 14, 2009
1 parent 896c8ae commit a7ad353
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 11 deletions.
5 changes: 5 additions & 0 deletions mono/metadata/ChangeLog
@@ -1,3 +1,8 @@
2009-12-14 Miguel de Icaza <miguel@novell.com>

* verify.c (mono_method_verify): The Unused opcodes produce an
InvalidProgramException on .NET

2009-12-14 Sebastien Pouliot <sebastien@ximian.com>

* loader.c (mono_method_get_header): Move assert after the verifier
Expand Down
16 changes: 7 additions & 9 deletions mono/metadata/verify.c
Expand Up @@ -5365,8 +5365,8 @@ mono_method_verify (MonoMethod *method, int level)
ip += 2;
break;

/* FIXME: warn/error instead? */
case CEE_UNUSED99:
ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("Use of the `unused' opcode"));
++ip;
break;

Expand Down Expand Up @@ -5557,7 +5557,8 @@ mono_method_verify (MonoMethod *method, int level)

case CEE_UNUSED58:
case CEE_UNUSED1:
++ip; /* warn, error ? */
ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("Use of the `unused' opcode"));
++ip;
break;

case CEE_UNBOX:
Expand Down Expand Up @@ -5811,10 +5812,6 @@ mono_method_verify (MonoMethod *method, int level)
ip += 5;
break;

case CEE_UNUSED56:
++ip;
break;

case CEE_LDARG:
case CEE_LDARGA:
code_bounds_check (3);
Expand All @@ -5834,7 +5831,11 @@ mono_method_verify (MonoMethod *method, int level)
++ip;
break;

case CEE_UNUSED56:
case CEE_UNUSED57:
case CEE_UNUSED70:
case CEE_UNUSED:
ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("Use of the `unused' opcode"));
++ip;
break;
case CEE_ENDFILTER:
Expand Down Expand Up @@ -5902,9 +5903,6 @@ mono_method_verify (MonoMethod *method, int level)
start = 1;
++ip;
break;
case CEE_UNUSED:
++ip;
break;

case CEE_SIZEOF:
code_bounds_check (5);
Expand Down
10 changes: 10 additions & 0 deletions mono/mini/ChangeLog
@@ -1,3 +1,13 @@
2009-12-14 Miguel de Icaza <miguel@novell.com>

* method-to-ir.c (mono_method_to_ir): CEE_UNUSUED opcodes now
raise an invalid program exception.

For other opcodes that we might not handle use a g_warning and
raise the exception. Beats termination.

Fixes #561724

2009-12-13 Jonathan Chambers <joncham@gmail.com>

* debugger-agent.c (mono_debugger_agent_thread_interrupt): Handle a NULL
Expand Down
18 changes: 16 additions & 2 deletions mono/mini/method-to-ir.c
Expand Up @@ -9775,13 +9775,27 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
readonly = TRUE;
ip += 2;
break;

case CEE_UNUSED56:
case CEE_UNUSED57:
case CEE_UNUSED70:
case CEE_UNUSED:
case CEE_UNUSED99:
UNVERIFIED;

default:
g_error ("opcode 0xfe 0x%02x not handled", ip [1]);
g_warning ("opcode 0xfe 0x%02x not handled", ip [1]);
UNVERIFIED;
}
break;
}
case CEE_UNUSED58:
case CEE_UNUSED1:
UNVERIFIED;

default:
g_error ("opcode 0x%02x not handled", *ip);
g_warning ("opcode 0x%02x not handled", *ip);
UNVERIFIED;
}
}
if (start_new_bblock != 1)
Expand Down

0 comments on commit a7ad353

Please sign in to comment.