summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-25 18:43:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-25 18:43:58 +0000
commitddfcb969300604b1f03887e2498779c7c879ca96 (patch)
tree463d3b2620a76fe33cd7f2274fa84f18697dde09 /test
parentf77d40235275c80a4e1771b55a9d2c86bf129b26 (diff)
safe.c: preserve encoding
* safe.c (rb_secure): preserve encoding of the called method name in error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_dir.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb
index ee1210cc37..03c62da547 100644
--- a/test/ruby/test_dir.rb
+++ b/test/ruby/test_dir.rb
@@ -304,4 +304,21 @@ class TestDir < Test::Unit::TestCase
end
}
end
+
+ def test_insecure_chdir
+ assert_raise(SecurityError) do
+ proc do
+ $SAFE=3
+ Dir.chdir("/")
+ end.call
+ end
+ m = "\u{79fb 52d5}"
+ d = Class.new(Dir) {singleton_class.class_eval {alias_method m, :chdir}}
+ assert_raise_with_message(SecurityError, /#{m}/) do
+ proc do
+ $SAFE=3
+ d.__send__(m, "/")
+ end.call
+ end
+ end
end