String#ljust taint bug
----------------------

                 Key: JRUBY-5271
                 URL: http://jira.codehaus.org/browse/JRUBY-5271
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.5.6
         Environment: ubuntu 10
jruby 1.5.6 (ruby 1.8.7 patchlevel 249) (2010-12-03 9cf97c3) (OpenJDK Client VM 
1.6.0_20) [i386-java]
            Reporter: Daniel Berger
            Priority: Minor


Obscure taint rule for String#ljust: even if the 2nd argument is tainted, the 
result is tainted if and only if the resulting string length is greater than 
the receiver's length.

With MRI (ruby 1.8.7-p302):

{code}
irb(main):001:0> 'hello'.ljust(4, 'X'.taint).tainted?
=> false
irb(main):002:0> 'hello'.ljust(5, 'X'.taint).tainted?
=> false
irb(main):003:0> 'hello'.ljust(6, 'X'.taint).tainted?
=> true
{code}

With JRuby 1.5.6:

{code}
irb(main):001:0> 'hello'.ljust(4, 'X'.taint).tainted?
=> true
irb(main):002:0> 'hello'.ljust(5, 'X'.taint).tainted?
=> true
irb(main):003:0> 'hello'.ljust(6, 'X'.taint).tainted?
=> true
{code}

-- 
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


Reply via email to