aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_thread.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-01 14:14:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-01 14:14:07 +0000
commitc56d9aaabf8f4886e1ba69d24024727ab905aed4 (patch)
tree7e4a89a484db3822d8c21967bac22a2e65567722 /test/ruby/test_thread.rb
parentd58f17f37d3c169d7acfe3860872519d44144ddf (diff)
downloadruby-c56d9aaabf8f4886e1ba69d24024727ab905aed4.tar.gz
thread.c: check name argument
* thread.c (rb_thread_setname): check the argument if valid string. [ruby-core:71774] [Bug #11756] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_thread.rb')
-rw-r--r--test/ruby/test_thread.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index d076494cdf..78ed329274 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -1057,4 +1057,22 @@ q.pop
t.kill
t.join
end
+
+ def test_thread_invalid_name
+ bug11756 = '[ruby-core:71774] [Bug #11756]'
+ t = Thread.start {}
+ assert_raise(ArgumentError, bug11756) {t.name = "foo\0bar"}
+ ensure
+ t.kill
+ t.join
+ end
+
+ def test_thread_invalid_object
+ bug11756 = '[ruby-core:71774] [Bug #11756]'
+ t = Thread.start {}
+ assert_raise(TypeError, bug11756) {t.name = nil}
+ ensure
+ t.kill
+ t.join
+ end
end