[前][次][番号順一覧][スレッド一覧]

ruby-changes:45932

From: nobu <ko1@a...>
Date: Fri, 17 Mar 2017 19:08:06 +0900 (JST)
Subject: [ruby-changes:45932] nobu:r58004 (trunk): vm.c: check stack

nobu	2017-03-17 19:08:02 +0900 (Fri, 17 Mar 2017)

  New Revision: 58004

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58004

  Log:
    vm.c: check stack
    
    * vm.c (invoke_iseq_block_from_c): check stack overflow before
      pushing arguments.

  Modified files:
    trunk/vm.c
Index: vm.c
===================================================================
--- vm.c	(revision 58003)
+++ vm.c	(revision 58004)
@@ -992,10 +992,12 @@ invoke_iseq_block_from_c(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/vm.c#L992
     const rb_iseq_t *iseq = rb_iseq_check(captured->code.iseq);
     int i, opt_pc;
     VALUE type = is_lambda ? VM_FRAME_MAGIC_LAMBDA : VM_FRAME_MAGIC_BLOCK;
-    VALUE *sp = th->cfp->sp;
+    rb_control_frame_t *cfp = th->cfp;
+    VALUE *sp = cfp->sp;
     const rb_callable_method_entry_t *me = th->passed_bmethod_me;
     th->passed_bmethod_me = NULL;
 
+    CHECK_VM_STACK_OVERFLOW(cfp, argc);
     for (i=0; i<argc; i++) {
 	sp[i] = argv[i];
     }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]