mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
string.c: should not taint fstring
* string.c (rb_obj_as_string): fstring should not be infected. TODO: other frozen strings also may not be. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e2977fc8f3
commit
b887c7c20a
3 changed files with 17 additions and 1 deletions
|
@ -755,6 +755,15 @@ class TestObject < Test::Unit::TestCase
|
|||
end
|
||||
EOS
|
||||
assert_match(/\bToS\u{3042}:/, x)
|
||||
|
||||
name = "X".freeze
|
||||
x = Object.new.taint
|
||||
class<<x;self;end.class_eval {define_method(:to_s) {name}}
|
||||
assert_same(name, x.to_s)
|
||||
assert_not_predicate(name, :tainted?)
|
||||
assert_raise(RuntimeError) {name.taint}
|
||||
assert_equal("X", [x].join(""))
|
||||
assert_not_predicate(name, :tainted?)
|
||||
end
|
||||
|
||||
def test_inspect
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue