IO#readpartial crashes when negative argument is specified
----------------------------------------------------------

                 Key: JRUBY-2635
                 URL: http://jira.codehaus.org/browse/JRUBY-2635
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.1.2
         Environment: Latest JRuby
            Reporter: Vladimir Sizikov
            Assignee: Vladimir Sizikov
             Fix For: JRuby 1.1.3


{noformat}

jruby -e "rd, wr = IO.pipe; rd.readpartial(-1)"
Exception in thread "main" java.lang.NegativeArraySizeException
        at org.jruby.util.ByteList.<init>(ByteList.java:67)
        at org.jruby.util.io.ChannelStream.read(ChannelStream.java:560)
        at org.jruby.util.io.ChannelStream.readpartial(ChannelStream.java:812)
        at org.jruby.RubyIO.readpartial(RubyIO.java:1993)
        at org.jruby.RubyIOInvoker$readpartial_method_0_1.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodNoBlock.call(JavaMethod.java:63)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:78)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:149)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:356)
        at ruby.__dash_e__.__file__(-e:1)
        at ruby.__dash_e__.__file__(-e)
        at ruby.__dash_e__.load(-e)
        at org.jruby.Ruby.runScript(Ruby.java:520)
        at org.jruby.Ruby.runNormally(Ruby.java:440)
        at org.jruby.Ruby.runFromMain(Ruby.java:320)
        at org.jruby.Main.run(Main.java:184)
        at org.jruby.Main.run(Main.java:91)
        at org.jruby.Main.main(Main.java:82)
{noformat}

MRI behavior:

{noformat}
-e:1:in `readpartial': negative length -1 given (ArgumentError)
{noformat}


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