mirror of
https://github.com/ruby/ruby.git
synced 2025-08-28 15:36:16 +02:00
string: preserve taint flag with String#-@ (uminus)
* string.c (tainted_fstr_update): move up (rb_fstring): support registering tainted strings (register_fstring_tainted): extract from rb_fstring_existing0 (rb_tainted_fstring_existing): use register_fstring_tainted instead git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1f67a3900f
commit
86e266bb60
2 changed files with 78 additions and 61 deletions
|
@ -2749,10 +2749,15 @@ CODE
|
|||
|
||||
assert_not_equal(str.object_id, (+str).object_id)
|
||||
assert_equal(str.object_id, (-str).object_id)
|
||||
|
||||
return unless @cls == String
|
||||
bar = %w(b a r).join('')
|
||||
assert_not_predicate bar, :tainted?
|
||||
assert_not_predicate str, :tainted?
|
||||
assert_same(str, -bar, "uminus deduplicates [Feature #13077]")
|
||||
bar = %w(b a r).taint.join('')
|
||||
tstr = str.dup.taint
|
||||
assert_same -tstr, -bar
|
||||
end
|
||||
|
||||
def test_ord
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue