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

ruby-changes:32661

From: usa <ko1@a...>
Date: Wed, 29 Jan 2014 13:34:12 +0900 (JST)
Subject: [ruby-changes:32661] usa:r44740 (ruby_1_9_3): merge revision(s) 43685, 43690, 43705: [Backport #9110]

usa	2014-01-29 13:33:59 +0900 (Wed, 29 Jan 2014)

  New Revision: 44740

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

  Log:
    merge revision(s) 43685,43690,43705: [Backport #9110]
    
    * eval_jump.c (rb_exec_end_proc): fix double free or corruption error
      when reentering by callcc. [ruby-core:58329] [Bug #9110]
    
    * test/ruby/test_beginendblock.rb: test for above.
    
    * eval_jump.c (rb_exec_end_proc): unlink and free procs data before
      calling for each procs.  [Bug #9110]

  Modified directories:
    branches/ruby_1_9_3/
  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/eval_jump.c
    branches/ruby_1_9_3/test/ruby/test_beginendblock.rb
    branches/ruby_1_9_3/version.h
Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 44739)
+++ ruby_1_9_3/ChangeLog	(revision 44740)
@@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L1
+Wed Jan 29 13:32:53 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* eval_jump.c (rb_exec_end_proc): unlink and free procs data before
+	  calling for each procs.  [Bug #9110]
+
+Wed Jan 29 13:32:53 2014  Masaki Matsushita  <glass.saga@g...>
+
+	* eval_jump.c (rb_exec_end_proc): fix double free or corruption error
+	  when reentering by callcc. [ruby-core:58329] [Bug #9110]
+
+	* test/ruby/test_beginendblock.rb: test for above.
+
 Wed Jan 29 13:25:32 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/resolv.rb (Resolv::Hosts#lazy_initialize): should not
Index: ruby_1_9_3/eval_jump.c
===================================================================
--- ruby_1_9_3/eval_jump.c	(revision 44739)
+++ ruby_1_9_3/eval_jump.c	(revision 44740)
@@ -96,7 +96,8 @@ rb_mark_end_proc(void) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/eval_jump.c#L96
 void
 rb_exec_end_proc(void)
 {
-    struct end_proc_data *volatile link;
+    struct end_proc_data volatile endproc;
+    struct end_proc_data volatile *link;
     int status;
     volatile int safe = rb_safe_level();
     rb_thread_t *th = GET_THREAD();
@@ -105,6 +106,9 @@ rb_exec_end_proc(void) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/eval_jump.c#L106
     while (ephemeral_end_procs) {
 	link = ephemeral_end_procs;
 	ephemeral_end_procs = link->next;
+	endproc = *link;
+	xfree((void *)link);
+	link = &endproc;
 
 	PUSH_TAG();
 	if ((status = EXEC_TAG()) == 0) {
@@ -116,12 +120,14 @@ rb_exec_end_proc(void) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/eval_jump.c#L120
 	    error_handle(status);
 	    if (!NIL_P(th->errinfo)) errinfo = th->errinfo;
 	}
-	xfree(link);
     }
 
     while (end_procs) {
 	link = end_procs;
 	end_procs = link->next;
+	endproc = *link;
+	xfree((void *)link);
+	link = &endproc;
 
 	PUSH_TAG();
 	if ((status = EXEC_TAG()) == 0) {
@@ -133,8 +139,8 @@ rb_exec_end_proc(void) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/eval_jump.c#L139
 	    error_handle(status);
 	    if (!NIL_P(th->errinfo)) errinfo = th->errinfo;
 	}
-	xfree(link);
     }
+
     rb_set_safe_level_force(safe);
     th->errinfo = errinfo;
 }
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 44739)
+++ ruby_1_9_3/version.h	(revision 44740)
@@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 494
+#define RUBY_PATCHLEVEL 495
 
 #define RUBY_RELEASE_DATE "2014-01-29"
 #define RUBY_RELEASE_YEAR 2014
Index: ruby_1_9_3/test/ruby/test_beginendblock.rb
===================================================================
--- ruby_1_9_3/test/ruby/test_beginendblock.rb	(revision 44739)
+++ ruby_1_9_3/test/ruby/test_beginendblock.rb	(revision 44740)
@@ -158,4 +158,15 @@ EOW https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/ruby/test_beginendblock.rb#L158
       assert_equal(["", "", 42], [out, err, status.exitstatus], "#{bug5218}: #{ex}")
     end
   end
+
+  def test_callcc_at_exit
+    bug9110 = '[ruby-core:58329][Bug #9110]'
+    script = <<EOS
+require "continuation"
+c = nil
+at_exit { c.call }
+at_exit { callcc {|_c| c = _c } }
+EOS
+    assert_normal_exit(script, bug9110)
+  end
 end

Property changes on: ruby_1_9_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r43685,43690,43705


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

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