StringIO.read(num, buffer) populates corrupt data in buffer or crashes jRuby ----------------------------------------------------------------------------
Key: JRUBY-3526 URL: http://jira.codehaus.org/browse/JRUBY-3526 Project: JRuby Issue Type: Bug Components: Core Classes/Modules, Ruby 1.8.7 Affects Versions: JRuby 1.2, JRuby 1.1.6 Environment: MacOSX 10.5.6 (Intel) java version "1.5.0_16" jRuby 1.1.6 and jRuby 1.2.0 Reporter: Michael Rykov Priority: Critical Fix For: JRuby 1.3, JRuby 1.x+, JRuby 2 Attachments: stringiocrash.rb I noticed the problem when my string data was getting altered when accessed through StringIO.read(num, buff) API I tried to create a small test file to reproduce the problem, but I ended up crashing jRuby instead. Here is what I get when I run the attached file: {code} $ jruby ./stringiocrash.rb blahblah java.lang.System:-2:in `arraycopy': java.lang.ArrayIndexOutOfBoundsException from org.jruby.util.ByteList:601:in `grow' from org.jruby.util.ByteList:320:in `unsafeReplace' from org.jruby.util.ByteList:336:in `replace' from org.jruby.RubyStringIO:605:in `read' from org.jruby.RubyStringIO$i_method_0_2$RUBYINVOKER$read:-1:in `call' from org.jruby.internal.runtime.methods.JavaMethod$JavaMethodNoBlock:62:in `call' from org.jruby.internal.runtime.methods.DynamicMethod:261:in `call' from org.jruby.internal.runtime.methods.DynamicMethod:169:in `call' from org.jruby.runtime.callsite.CachingCallSite:300:in `cacheAndCall' from org.jruby.runtime.callsite.CachingCallSite:157:in `call' from $_dot_.stringiocrash:7:in `__file__' from $_dot_.stringiocrash:-1:in `__file__' from $_dot_.stringiocrash:-1:in `load' from org.jruby.Ruby:564:in `runScript' from org.jruby.Ruby:467:in `runNormally' from org.jruby.Ruby:340:in `runFromMain' from org.jruby.Main:214:in `run' from org.jruby.Main:100:in `run' from org.jruby.Main:84:in `main' $ {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