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

ruby-changes:27021

From: ktsj <ko1@a...>
Date: Wed, 6 Feb 2013 00:55:53 +0900 (JST)
Subject: [ruby-changes:27021] ktsj:r39073 (trunk): * vm.c (rb_vm_stack_to_heap): call rb_vm_get_binding_creatable_next_cfp

ktsj	2013-02-06 00:55:41 +0900 (Wed, 06 Feb 2013)

  New Revision: 39073

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39073

  Log:
    * vm.c (rb_vm_stack_to_heap): call rb_vm_get_binding_creatable_next_cfp
      instead of rb_vm_get_ruby_level_next_cfp to prevent a segfault by
      calling Kernel#callcc. See r39067 for more details.
      [ruby-dev:46908] [ruby-trunk - Bug #7774]
    
    * test/ruby/test_settracefunc.rb: add a test.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_settracefunc.rb
    trunk/vm.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39072)
+++ ChangeLog	(revision 39073)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Feb  6 00:46:53 2013  Kazuki Tsujimoto  <kazuki@c...>
+
+	* vm.c (rb_vm_stack_to_heap): call rb_vm_get_binding_creatable_next_cfp
+	  instead of rb_vm_get_ruby_level_next_cfp to prevent a segfault by
+	  calling Kernel#callcc. See r39067 for more details.
+	  [ruby-dev:46908] [ruby-trunk - Bug #7774]
+
+	* test/ruby/test_settracefunc.rb: add a test.
+
 Tue Feb  5 18:48:00 2013  Charlie Somerville  <charlie@c...>
 
 	* doc/security.rdoc: add regex, eval and drb sections
Index: vm.c
===================================================================
--- vm.c	(revision 39072)
+++ vm.c	(revision 39073)
@@ -553,7 +553,7 @@ void https://github.com/ruby/ruby/blob/trunk/vm.c#L553
 rb_vm_stack_to_heap(rb_thread_t *th)
 {
     rb_control_frame_t *cfp = th->cfp;
-    while ((cfp = rb_vm_get_ruby_level_next_cfp(th, cfp)) != 0) {
+    while ((cfp = rb_vm_get_binding_creatable_next_cfp(th, cfp)) != 0) {
 	rb_vm_make_env_object(th, cfp);
 	cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
     }
Index: test/ruby/test_settracefunc.rb
===================================================================
--- test/ruby/test_settracefunc.rb	(revision 39072)
+++ test/ruby/test_settracefunc.rb	(revision 39073)
@@ -943,7 +943,8 @@ class TestSetTraceFunc < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/ruby/test_settracefunc.rb#L943
   end
 
   def test_trace_point_binding_in_ifunc
-    assert_normal_exit %q{
+    bug7774 = '[ruby-dev:46908]'
+    src = %q{
       tp = TracePoint.new(:raise) do |tp|
         tp.binding
       end
@@ -955,8 +956,18 @@ class TestSetTraceFunc < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/ruby/test_settracefunc.rb#L956
             yield 1
           end
         end
-        obj.zip({}) {}
+        %s
       end
-    }, '[ruby-dev:46908] [ruby-trunk - Bug #7774]'
+    }
+    assert_normal_exit src % %q{obj.zip({}) {}}, bug7774
+    assert_normal_exit src % %q{
+      require 'continuation'
+      begin
+        c = nil
+        obj.sort_by {|x| callcc {|c2| c ||= c2 }; x }
+        c.call
+      rescue RuntimeError
+      end
+    }, bug7774
   end
 end

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

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