summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-27 07:48:53 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-27 07:48:53 +0000
commit04b031656add2a8c9f7f2136e4fc7fc16c9ac901 (patch)
tree2998e533888161f911a99d87e7ca7021b3ce3f13
parentad559b5c1cbaa50273c8063951a4e64a9f2c1fe7 (diff)
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@56505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog11
-rw-r--r--eval_intern.h2
-rw-r--r--test/ruby/test_exception.rb10
-rw-r--r--version.h2
4 files changed, 23 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c0550a6e1d..f143089b4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Thu Oct 27 16:47:57 2016 Kazuki Yamaguchi <k@rhe.jp>
+
+ * 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.
+
Thu Oct 27 16:39:56 2016 Aurelien Jacobs <aurel@gnuage.org>
* lib/logger.rb (Logger::Period#next_rotate_time): fix monthly log
diff --git a/eval_intern.h b/eval_intern.h
index 163eeb1a85..9dc6f7841a 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -122,7 +122,7 @@ LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *);
#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() \
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb
index 5ca54ecbe1..c49de80113 100644
--- a/test/ruby/test_exception.rb
+++ b/test/ruby/test_exception.rb
@@ -180,6 +180,16 @@ class TestException < Test::Unit::TestCase
}
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)
diff --git a/version.h b/version.h
index cab66e0035..ee3080693e 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.2.6"
#define RUBY_RELEASE_DATE "2016-10-27"
-#define RUBY_PATCHLEVEL 383
+#define RUBY_PATCHLEVEL 384
#define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 10