1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

vm_insnhelper.c: check symbol proc to throw

* vm_insnhelper.c (vm_throw_start): check if the iseq is symbol
  proc, class definition should not be a symbol proc.
  [ruby-core:75856] [Bug #12462]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-06-06 09:37:59 +00:00
parent ab5f23f26c
commit 65ac4a5602
3 changed files with 18 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Mon Jun 6 18:37:57 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_insnhelper.c (vm_throw_start): check if the iseq is symbol
proc, class definition should not be a symbol proc.
[ruby-core:75856] [Bug #12462]
Mon Jun 6 18:36:34 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* string.c: Added UTF-16BE/LE and UTF-32BE/LE to supported encodings

View file

@ -157,6 +157,15 @@ class TestSymbol < Test::Unit::TestCase
assert_equal(1, first, bug11594)
end
private def return_from_proc
Proc.new { return 1 }.tap(&:call)
end
def test_return_from_symbol_proc
bug12462 = '[ruby-core:75856] [Bug #12462]'
assert_equal(1, return_from_proc, bug12462)
end
def test_to_proc_for_hash_each
bug11830 = '[ruby-core:72205] [Bug #11830]'
assert_normal_exit(<<-'end;', bug11830) # do

View file

@ -995,7 +995,9 @@ vm_throw_start(rb_thread_t *const th, rb_control_frame_t *const reg_cfp, enum ru
target_lep = lep;
}
if (lep == target_lep && escape_cfp->iseq->body->type == ISEQ_TYPE_CLASS) {
if (lep == target_lep &&
RUBY_VM_NORMAL_ISEQ_P(escape_cfp->iseq) &&
escape_cfp->iseq->body->type == ISEQ_TYPE_CLASS) {
in_class_frame = 1;
target_lep = 0;
}