diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-25 18:43:47 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-25 18:43:47 +0000 |
commit | f77d40235275c80a4e1771b55a9d2c86bf129b26 (patch) | |
tree | 6209d8dbc2e49789b134c0ed21671b34b7b1728b /test/ruby | |
parent | 5af1a10d7ce4e156e5587a25a0dd2cf88dd52a57 (diff) | |
download | ruby-f77d40235275c80a4e1771b55a9d2c86bf129b26.tar.gz |
safe.c: preserve encoding
* safe.c (rb_insecure_operation): preserve encoding of the called
method name in error messages.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_file.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb index 0825c5dd7b..16b76b71fe 100644 --- a/test/ruby/test_file.rb +++ b/test/ruby/test_file.rb @@ -390,6 +390,12 @@ class TestFile < Test::Unit::TestCase (0..1).each do |level| assert_nothing_raised(SecurityError, bug5374) {in_safe[level]} end + def (s = Object.new).to_path; "".taint; end + m = "\u{691c 67fb}" + (c = Class.new(File)).singleton_class.class_eval {alias_method m, :stat} + assert_raise_with_message(SecurityError, /#{m}/) { + proc {$SAFE = 3; c.__send__(m, s)}.call + } end if /(bcc|ms|cyg)win|mingw|emx/ =~ RUBY_PLATFORM |