* vm_insnhelper.c (vm_push_frame): fix stack overflow check codes.

Stack overflow check should be done *after* pushing a stack frame.
  However, some stack overflow checking codes checked *before*
  pushing a stack frame with iseq->stack_max.
  To solve this problem, add a new parameter `stack_max' to specify
  a possible consuming stack size.
* vm_core.h (CHECK_VM_STACK_OVERFLOW0): add to share the stack overflow
  checking code.
* insns.def: catch up this change.
* vm.c, vm_eval.c: ditto.
* test/ruby/test_exception.rb: add a stack overflow test.
  This code is reported by nobu.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2013-08-06 08:33:05 +00:00
parent 8ea8dfd88c
commit 22468a4f92
7 changed files with 52 additions and 30 deletions

View file

@ -456,4 +456,13 @@ end.join
s = e.to_s
assert_equal(false, s.tainted?)
end
def m;
m &->{return 0};
42;
end
def test_stackoverflow
assert_raise(SystemStackError){m}
end
end