Cause an ArrayIndexOutOfBounds when initialize Regexp
-----------------------------------------------------
Key: JRUBY-2268
URL: http://jira.codehaus.org/browse/JRUBY-2268
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.1RC2, JRuby 1.0.3
Environment: ruby 1.8.6 (2008-02-16 rev 5944) [i386-jruby1.1RC2]
ruby 1.8.5 (2007-12-15 rev 5200) [i386-jruby1.0.3]
Reporter: Tooru TAKAHASHI
Assignee: Thomas E Enebo
Regexp.new throws an ArrayIndexOutOfBoundsException in 1.1RC2 and 1.0.3.
Reason:
RubyRegexp.java l.469 in 1.1RC2 and KCode.java l.55 in 1.0.3
Those may be considered `nil', but unconsidered an empty String
{code}
% jruby -v
ruby 1.8.6 (2008-02-16 rev 5944) [i386-jruby1.1RC2]
% jruby -e 'Regexp.new("a", 0, "")'
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at org.jruby.util.ByteList.charAt(ByteList.java:717)
at org.jruby.RubyRegexp.initialize_m(RubyRegexp.java:469)
at org.jruby.RubyRegexpInvoker$initialize_m_method_0_3.call(Unknown
Source)
at
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodNoBlock.call(JavaMethod.java:63)
at org.jruby.RubyClass.invoke(RubyClass.java:236)
at
org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:314)
at org.jruby.RubyObject.callMethod(RubyObject.java:475)
at org.jruby.RubyObject.callInit(RubyObject.java:485)
at org.jruby.RubyRegexp.newInstance(RubyRegexp.java:500)
at org.jruby.RubyRegexpInvoker$newInstance_method_1_2.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:94)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:207)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:371)
at __dash_e__.__file__(-e:1)
at __dash_e__.load(-e)
at org.jruby.Ruby.runScript(Ruby.java:497)
at org.jruby.Ruby.runNormally(Ruby.java:417)
at org.jruby.Ruby.runFromMain(Ruby.java:297)
at org.jruby.Main.run(Main.java:141)
at org.jruby.Main.run(Main.java:88)
at org.jruby.Main.main(Main.java:79)
{code}
{code}
% jruby -v
ruby 1.8.5 (2007-12-15 rev 5200) [i386-jruby1.0.3]
% jruby -e 'Regexp.new("a", 0, "")'
ava.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:687)
at org.jruby.util.KCode.create(KCode.java:55) at
org.jruby.RubyRegexp.initialize(RubyRegexp.java:295) at
org.jruby.RubyRegexpInvokerinitializexx1.call(Unknown Source) at
org.jruby.runtime.callback.FastInvocationCallback.execute(FastInvocationCallback.java:49)
at
org.jruby.internal.runtime.methods.SimpleCallbackMethod.call(SimpleCallbackMethod.java:81)
at org.jruby.RubyObject.callMethod(RubyObject.java:574)
at org.jruby.RubyObject.callMethod(RubyObject.java:448)
at org.jruby.RubyObject.callInit(RubyObject.java:665)
at org.jruby.RubyRegexp.newInstance(RubyRegexp.java:276)
at org.jruby.RubyRegexpInvokerSnewInstancexx1.call(Unknown Source)
at
org.jruby.runtime.callback.FastInvocationCallback.execute(FastInvocationCallback
.java:49)
at
org.jruby.internal.runtime.methods.SimpleCallbackMethod.call(SimpleCallbackMetho
d.java:81)
at org.jruby.RubyObject.compilerCallMethod(RubyObject.java:507)
at
org.jruby.javasupport.util.CompilerHelpers.doInvokeDynamic(CompilerHelpers.java:124)
at EVAL1035988.__file__(EVAL1035988:1)
at EVAL1035988.run(EVAL1035988) at
org.jruby.Ruby.compileOrFallbackAndRun(Ruby.java:310)
at org.jruby.Main.runInterpreter(Main.java:238)
at org.jruby.Main.runInterpreter(Main.java:183)
at org.jruby.Main.run(Main.java:120)
at org.jruby.Main.main(Main.java:95)
{code}
best regards.
--
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