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

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_3@56441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2016-10-17 18:07:08 +00:00
parent 69f86f79e2
commit ded4039231
4 changed files with 23 additions and 2 deletions

View file

@ -1,3 +1,14 @@
Tue Oct 18 02:58:22 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.
Tue Oct 18 02:24:29 2016 Aurelien Jacobs <aurel@gnuage.org> Tue Oct 18 02:24:29 2016 Aurelien Jacobs <aurel@gnuage.org>
* lib/logger.rb (Logger::Period#next_rotate_time): fix monthly log * lib/logger.rb (Logger::Period#next_rotate_time): fix monthly log

View file

@ -121,7 +121,7 @@ LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *);
#define TH_PUSH_TAG(th) do { \ #define TH_PUSH_TAG(th) do { \
rb_thread_t * const _th = (th); \ rb_thread_t * const _th = (th); \
struct rb_vm_tag _tag; \ struct rb_vm_tag _tag; \
_tag.tag = 0; \ _tag.tag = Qundef; \
_tag.prev = _th->tag; _tag.prev = _th->tag;
#define TH_POP_TAG() \ #define TH_POP_TAG() \

View file

@ -181,6 +181,16 @@ class TestException < Test::Unit::TestCase
} }
end 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 def test_else_no_exception
begin begin
assert(true) assert(true)

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.3.2" #define RUBY_VERSION "2.3.2"
#define RUBY_RELEASE_DATE "2016-10-18" #define RUBY_RELEASE_DATE "2016-10-18"
#define RUBY_PATCHLEVEL 199 #define RUBY_PATCHLEVEL 200
#define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 10 #define RUBY_RELEASE_MONTH 10