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

ruby-changes:44368

From: nagachika <ko1@a...>
Date: Tue, 18 Oct 2016 03:07:13 +0900 (JST)
Subject: [ruby-changes:44368] nagachika:r56441 (ruby_2_3): merge revision(s) 56252, 56254: [Backport #12743]

nagachika	2016-10-18 03:07:08 +0900 (Tue, 18 Oct 2016)

  New Revision: 56441

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

  Log:
    merge revision(s) 56252,56254: [Backport #12743]
    
    * eval_intern.h (TH_PUSH_TAG): Initialize struct rb_vm_tag::tag with
      Qundef rather than 0 which is equal to Qfalse. Since Kernel#throw(obj)
      searches a tag with rb_vm_tag::tag == obj, throw(false) can
      accidentally find an unrelated tag which is not created by
      Kernel#catch.  [ruby-core:77229] [Bug #12743]
    
    * test/ruby/test_exception.rb (test_throw_false): Add a test case for
      this.

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/eval_intern.h
    branches/ruby_2_3/test/ruby/test_exception.rb
    branches/ruby_2_3/version.h
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 56440)
+++ ruby_2_3/ChangeLog	(revision 56441)
@@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Tue Oct 18 02:58:22 2016  Kazuki Yamaguchi  <k@r...>
+
+	* eval_intern.h (TH_PUSH_TAG): Initialize struct rb_vm_tag::tag with
+	  Qundef rather than 0 which is equal to Qfalse. Since Kernel#throw(obj)
+	  searches a tag with rb_vm_tag::tag == obj, throw(false) can
+	  accidentally find an unrelated tag which is not created by
+	  Kernel#catch.  [ruby-core:77229] [Bug #12743]
+
+	* test/ruby/test_exception.rb (test_throw_false): Add a test case for
+	  this.
+
 Tue Oct 18 02:24:29 2016  Aurelien Jacobs  <aurel@g...>
 
 	* lib/logger.rb (Logger::Period#next_rotate_time): fix monthly log
Index: ruby_2_3/eval_intern.h
===================================================================
--- ruby_2_3/eval_intern.h	(revision 56440)
+++ ruby_2_3/eval_intern.h	(revision 56441)
@@ -121,7 +121,7 @@ LONG WINAPI rb_w32_stack_overflow_handle https://github.com/ruby/ruby/blob/trunk/ruby_2_3/eval_intern.h#L121
 #define TH_PUSH_TAG(th) do { \
   rb_thread_t * const _th = (th); \
   struct rb_vm_tag _tag; \
-  _tag.tag = 0; \
+  _tag.tag = Qundef; \
   _tag.prev = _th->tag;
 
 #define TH_POP_TAG() \
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 56440)
+++ ruby_2_3/version.h	(revision 56441)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.2"
 #define RUBY_RELEASE_DATE "2016-10-18"
-#define RUBY_PATCHLEVEL 199
+#define RUBY_PATCHLEVEL 200
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 10
Index: ruby_2_3/test/ruby/test_exception.rb
===================================================================
--- ruby_2_3/test/ruby/test_exception.rb	(revision 56440)
+++ ruby_2_3/test/ruby/test_exception.rb	(revision 56441)
@@ -181,6 +181,16 @@ class TestException < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_exception.rb#L181
     }
   end
 
+  def test_throw_false
+    bug12743 = '[ruby-core:77229] [Bug #12743]'
+    e = assert_raise_with_message(UncaughtThrowError, /false/, bug12743) {
+      Thread.start {
+        throw false
+      }.join
+    }
+    assert_same(false, e.tag, bug12743)
+  end
+
   def test_else_no_exception
     begin
       assert(true)

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r56252,56254


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

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