mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_printf.rb: need to be infected
* test/-ext-/test_printf.rb (Test_SPrintf#test_{taint,untrust}): use plain object so that the results of to_s and inspect are infected. [ruby-dev:46053] [Bug #6881] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5225cc16fe
commit
f230b1ec98
2 changed files with 13 additions and 11 deletions
|
@ -1,3 +1,9 @@
|
|||
Thu Aug 16 11:52:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* test/-ext-/test_printf.rb (Test_SPrintf#test_{taint,untrust}): use
|
||||
plain object so that the results of to_s and inspect are infected.
|
||||
[ruby-dev:46053] [Bug #6881]
|
||||
|
||||
Thu Aug 16 09:46:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* strftime.c: remove unnecessary macros to check traditional C.
|
||||
|
|
|
@ -30,24 +30,20 @@ class Test_SPrintf < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_taint
|
||||
def self.to_s
|
||||
super.taint
|
||||
end
|
||||
obj = Object.new.taint
|
||||
assert_equal({to_s: true, inspect: true},
|
||||
{
|
||||
to_s: Bug::Printf.s(self).tainted?,
|
||||
inspect: Bug::Printf.v(self).tainted?,
|
||||
to_s: Bug::Printf.s(obj).tainted?,
|
||||
inspect: Bug::Printf.v(obj).tainted?,
|
||||
})
|
||||
end
|
||||
|
||||
def test_trust
|
||||
def self.to_s
|
||||
super.untrust
|
||||
end
|
||||
def test_untrust
|
||||
obj = Object.new.untrust
|
||||
assert_equal({to_s: true, inspect: true},
|
||||
{
|
||||
to_s: Bug::Printf.s(self).untrusted?,
|
||||
inspect: Bug::Printf.v(self).untrusted?,
|
||||
to_s: Bug::Printf.s(obj).untrusted?,
|
||||
inspect: Bug::Printf.v(obj).untrusted?,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue