[interp] fix stack alloc size
authorBernhard Urban <bernhard.urban@xamarin.com>
Tue, 4 Apr 2017 09:16:27 +0000 (11:16 +0200)
committerBernhard Urban <bernhard.urban@xamarin.com>
Wed, 5 Apr 2017 18:41:05 +0000 (20:41 +0200)
mono/mini/interp/transform.c

index 6012bb1e1d78eb1b5b26a0a0972cbecedfebc594..8c2ac6f0a50b28a98bd9def44274a731f8eae1ad 100644 (file)
@@ -3519,7 +3519,7 @@ mono_interp_transform_method (RuntimeMethod *runtime_method, ThreadContext *cont
        }
 
        runtime_method->local_offsets = g_malloc (header->num_locals * sizeof(guint32));
-       runtime_method->stack_size = (sizeof (stackval) + 2) * header->max_stack; /* + 1 for returns of called functions  + 1 for 0-ing in trace*/
+       runtime_method->stack_size = (sizeof (stackval)) * (header->max_stack + 2); /* + 1 for returns of called functions  + 1 for 0-ing in trace*/
        runtime_method->stack_size = (runtime_method->stack_size + 7) & ~7;
        offset = 0;
        for (i = 0; i < header->num_locals; ++i) {