String#crypt thwors IOOBE when high-order bytes present in the argument
-----------------------------------------------------------------------
Key: JRUBY-1783
URL: http://jira.codehaus.org/browse/JRUBY-1783
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.x
Environment: Latest JRuby 1.1b1 from trunk
Reporter: Vladimir Sizikov
Attachments: string-crypt-exception.patch
The folowing example:
"hello".crypt("\x80\x80")
Works fine under MRI 1.8.6, 1.9, Rubinius, but fails hard with JRuby:
{noformat}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 128
at org.jruby.RubyString$JavaCrypt.crypt(RubyString.java:1586)
at org.jruby.RubyString.crypt(RubyString.java:1067)
at org.jruby.RubyStringInvoker$crypt_method_1_0.call(Unknown Source)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:158)
at
org.jruby.runtime.CallSite$ArgumentBoxingCallSite.call(CallSite.java:103)
at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:652)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:299)
at org.jruby.evaluator.ASTInterpreter.rootNode(ASTInterpreter.java:1601)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:448)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
at
org.jruby.evaluator.ASTInterpreter.evalWithBinding(ASTInterpreter.java:217)
at org.jruby.RubyKernel.eval(RubyKernel.java:740)
at org.jruby.RubyKernelInvoker$eval_method_1_3.call(Unknown Source)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:158)
at
org.jruby.runtime.CallSite$ArgumentBoxingCallSite.call(CallSite.java:103)
at
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1092)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:345)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:147)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:158)
at
org.jruby.runtime.CallSite$ArgumentBoxingCallSite.call(CallSite.java:103)
at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:652)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:299)
at
org.jruby.evaluator.ASTInterpreter.setupArgs(ASTInterpreter.java:2140)
at
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1087)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:345)
at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:626)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:293)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:147)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:158)
at
org.jruby.runtime.CallSite$ArgumentBoxingCallSite.call(CallSite.java:103)
at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:652)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:299)
at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:626)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:293)
at
org.jruby.evaluator.ASTInterpreter.rescueNode(ASTInterpreter.java:1499)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:442)
at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:626)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:293)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:176)
at org.jruby.runtime.Block.yield(Block.java:115)
at
org.jruby.evaluator.ASTInterpreter.yieldNode(ASTInterpreter.java:1803)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:483)
at
org.jruby.evaluator.ASTInterpreter.ensureNode(ASTInterpreter.java:1064)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:339)
at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:626)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:293)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:147)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:158)
at
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1097)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:345)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:176)
at org.jruby.runtime.Block.yield(Block.java:115)
at
org.jruby.evaluator.ASTInterpreter.yieldNode(ASTInterpreter.java:1803)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:483)
at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:626)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:293)
at
org.jruby.evaluator.ASTInterpreter.rescueNode(ASTInterpreter.java:1499)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:442)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:176)
at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:141)
at org.jruby.runtime.Block.yield(Block.java:110)
at org.jruby.RubyKernel.loop(RubyKernel.java:926)
at org.jruby.RubyKernelInvoker$loop_method_0_0.call(Unknown Source)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:158)
at
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1097)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:345)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:176)
at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:141)
at org.jruby.runtime.Block.yield(Block.java:110)
at org.jruby.RubyKernel.rbCatch(RubyKernel.java:769)
at org.jruby.RubyKernelInvoker$rbCatch_method_1_0.call(Unknown Source)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:158)
at
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1097)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:345)
at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:626)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:293)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:147)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:158)
at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:657)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:299)
at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:626)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:293)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:147)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:158)
at
org.jruby.runtime.CallSite$ArgumentBoxingCallSite.call(CallSite.java:103)
at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:652)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:299)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:176)
at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:141)
at org.jruby.runtime.Block.yield(Block.java:110)
at org.jruby.RubyKernel.rbCatch(RubyKernel.java:769)
at org.jruby.RubyKernelInvoker$rbCatch_method_1_0.call(Unknown Source)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:158)
at
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1097)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:345)
at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:626)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:293)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:147)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:158)
at
org.jruby.runtime.CallSite$ArgumentBoxingCallSite.call(CallSite.java:103)
at
ruby.opt.work.jruby_dot_git.bin.jirb.__file__(/opt/work/jruby/bin/jirb:13)
at ruby.opt.work.jruby_dot_git.bin.jirb.load(/opt/work/jruby/bin/jirb)
at org.jruby.Ruby.runScript(Ruby.java:622)
at org.jruby.Ruby.runNormally(Ruby.java:542)
at org.jruby.Ruby.runFromMain(Ruby.java:465)
at org.jruby.Main.runInterpreter(Main.java:214)
at org.jruby.Main.runInterpreter(Main.java:170)
at org.jruby.Main.run(Main.java:119)
at org.jruby.Main.run(Main.java:93)
at org.jruby.Main.main(Main.java:84)
{noformat}
The proposed patch fixes the problem, also adding the regression test.
--
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