StringScanner#peek crashes JRuby in some situations
---------------------------------------------------

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


jruby -rstrscan -e "s = StringScanner.new('test string'); p s.peek(-20)" #==>

{noformat}
Exception in thread "main" java.lang.NegativeArraySizeException
        at org.jruby.util.ByteList.<init>(ByteList.java:67)
        at org.jruby.RubyString.inspectIntoByteList(RubyString.java:982)
        at org.jruby.RubyString.inspect(RubyString.java:973)
        at org.jruby.RubyStringInvoker$inspect_method_0_0.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZero.call(JavaMethod.java:82)
        at org.jruby.RubyClass.invoke(RubyClass.java:238)
        at 
org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:270)
        at org.jruby.RubyObject.callMethod(RubyObject.java:716)
        at org.jruby.RubyObject.inspect(RubyObject.java:1540)
        at org.jruby.RubyKernel.p(RubyKernel.java:284)
        at org.jruby.RubyKernelInvoker$p_s_method_0_0.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:216)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:125)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:141)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:336)
        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}

Fix is coming.

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