From 02ca93318b16d324fa6c36feacb88681175dee8b Mon Sep 17 00:00:00 2001 From: Rodrigo Kumpera Date: Fri, 18 Aug 2017 15:00:45 -0700 Subject: [PATCH 1/1] [verifier] Base constructors can only be called on uninit'd this pointers. Fix #12157. --- mono/metadata/verify.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mono/metadata/verify.c b/mono/metadata/verify.c index 3677d9e4b70..fa38edffc03 100644 --- a/mono/metadata/verify.c +++ b/mono/metadata/verify.c @@ -3227,6 +3227,8 @@ do_invoke_method (VerifyContext *ctx, int method_token, gboolean virtual_) value = stack_pop_safe (ctx); if (IS_STRICT_MODE (ctx) && (value->stype & THIS_POINTER_MASK) != THIS_POINTER_MASK) CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Invalid 'this ptr' argument for constructor at 0x%04x", ctx->ip_offset)); + if (!(value->stype & UNINIT_THIS_MASK)) + CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Calling the base constructor on an initialized this pointer at 0x%04x", ctx->ip_offset)); } else { value = stack_pop (ctx); } -- 2.25.1