diff options
author | Miguel de Icaza <miguel@gnome.org> | 2009-12-15 00:14:05 +0300 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2009-12-15 00:14:05 +0300 |
commit | a7ad353f6984d097f139f75a4bac3f82cb604442 (patch) | |
tree | 5ae9e09c0dcbe626054eb4225ee220f21331d56d | |
parent | 896c8ae4851b5a471e48d5e0e2b92dfabbb16f46 (diff) |
Backport from trunk
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
-rw-r--r-- | mono/metadata/ChangeLog | 5 | ||||
-rw-r--r-- | mono/metadata/verify.c | 16 | ||||
-rw-r--r-- | mono/mini/ChangeLog | 10 | ||||
-rw-r--r-- | mono/mini/method-to-ir.c | 18 |
4 files changed, 38 insertions, 11 deletions
diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog index 31bf65bc46c..b237ecaed57 100644 --- a/mono/metadata/ChangeLog +++ b/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 diff --git a/mono/metadata/verify.c b/mono/metadata/verify.c index 8b0608248cd..495537a7ab3 100644 --- a/mono/metadata/verify.c +++ b/mono/metadata/verify.c @@ -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; @@ -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: @@ -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); @@ -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: @@ -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); diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index 51b6978c0d2..57f27b46a56 100644 --- a/mono/mini/ChangeLog +++ b/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 diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c index 1f93f2d58d8..98c27ed01ac 100644 --- a/mono/mini/method-to-ir.c +++ b/mono/mini/method-to-ir.c @@ -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) |