IO#read crashes JRuby when pos is bigger than the file length
-------------------------------------------------------------
Key: JRUBY-2789
URL: http://jira.codehaus.org/browse/JRUBY-2789
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.1.2
Environment: Latest JRuby 1.1.3-dev
Reporter: Vladimir Sizikov
Assignee: Vladimir Sizikov
Fix For: JRuby 1.1.3
{noformat}
jruby -e "io = File.open('data.dat'); io.pos=1000; io.read"
Exception in thread "main" java.lang.NegativeArraySizeException
at org.jruby.util.ByteList.<init>(ByteList.java:67)
at org.jruby.util.io.ChannelStream.readall(ChannelStream.java:336)
at org.jruby.RubyIO.readAll(RubyIO.java:2342)
at org.jruby.RubyIO.read(RubyIO.java:2158)
at org.jruby.RubyIOInvoker$read_method_multi.call(Unknown Source)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:123)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:333)
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:544)
at org.jruby.Ruby.runNormally(Ruby.java:457)
at org.jruby.Ruby.runFromMain(Ruby.java:330)
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}
Will fix.
--
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