From c475f64d8c74057cbee8a0012491c9a5b89e4b9e Mon Sep 17 00:00:00 2001 From: k0kubun Date: Tue, 24 Jul 2018 15:40:05 +0000 Subject: mjit.c: handle memory allocation failure which was missing in r64033. Prior to r64033, memory allocation failure had been checked by TRY_WITH_GC and handled by rb_memerror. But calling rb_memerror on MJIT worker is problematic since it does EC_JUMP_TAG in the end. Threads except Ruby's main thread must not use it. mjit_compile.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- mjit_compile.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mjit_compile.c') diff --git a/mjit_compile.c b/mjit_compile.c index 7b8e2a7312..a44d9d9aba 100644 --- a/mjit_compile.c +++ b/mjit_compile.c @@ -193,6 +193,8 @@ mjit_compile(FILE *f, const struct rb_iseq_constant_body *body, const char *func status.success = TRUE; status.local_stack_p = !body->catch_except_p; status.stack_size_for_pos = (int *)malloc(sizeof(int) * body->iseq_size); + if (status.stack_size_for_pos == NULL) + return FALSE; memset(status.stack_size_for_pos, NOT_COMPILED_STACK_SIZE, sizeof(int) * body->iseq_size); /* For performance, we verify stack size only on compilation time (mjit_compile.inc.erb) without --jit-debug */ -- cgit v1.2.3