String#slice and #[] on tainted string might incorrectly return untainted string
--------------------------------------------------------------------------------
Key: JRUBY-1721
URL: http://jira.codehaus.org/browse/JRUBY-1721
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Environment: JRuby 1.1b1, latest trunk. Ubuntu Linux 7.10.
Reporter: Vladimir Sizikov
Attachments: string_slice_tainted.diff
Consider the example:
s = "blah"
s.taint
puts s[0,0].tainted?
MRI 1.8.6, MRI 1.9, Rubinius, all return true.
JRuby returns false.
This leads to a numerous rubinius spec failures, e.g.:
String#[] with index, length always taints resulting strings when self is
tainted FAILED
Expected false to equal true
/opt/work/rubinius/spec/mini_rspec.rb:221:in `=='
/opt/work/rubinius/./spec/core/string/shared/slice.rb:89:in `=='
/opt/work/rubinius/./spec/core/string/shared/slice.rb:85:in `it'
/opt/work/rubinius/spec/mini_rspec.rb:414:in `it'
/opt/work/rubinius/./spec/core/string/shared/slice.rb:85:in `it'
/opt/work/rubinius/./spec/core/string/shared/slice.rb:85:in `describe'
/opt/work/rubinius/spec/mini_rspec.rb:410:in `describe'
/opt/work/rubinius/./spec/core/string/shared/slice.rb:40:in `describe'
/opt/work/rubinius/./spec/core/string/shared/slice.rb:40:in `call'
/opt/work/rubinius/./spec/core/string/../../spec_helper.rb:154:in
`it_behaves_like'
/opt/work/rubinius/./spec/core/string/element_reference_spec.rb:6:in
`it_behaves_like'
/opt/work/rubinius/./spec/core/string/element_reference_spec.rb:5:in `describe'
/opt/work/rubinius/spec/mini_rspec.rb:410:in `describe'
/opt/work/rubinius/./spec/core/string/element_reference_spec.rb:5:in `describe'
/opt/work/rubinius/./spec/core/string/element_reference_spec.rb:5:in `load'
tmp/last_mspec.rb:13:in `load'
tmp/last_mspec.rb:1:in `each'
tmp/last_mspec.rb:7:in `each'
The proposed patch fixes this problem and 5 or 6 rubinius spec failures too. :)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email