Closed Bug 274996 Opened 21 years ago Closed 21 years ago

Exceptions with multiple interpreters on stack may lead to ArrayIndexOutOfBoundsException

Categories

(Rhino Graveyard :: Core, defect)

1.5R5
x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: thomas.hentschel, Assigned: igor)

Details

Attachments

(2 files, 1 obsolete file)

In a scenario where multiple rhino interpreters are on the Java stack, and an exception is thrown during the execution of Java code (thru LiveConnect), an ArrayOutOfBoundException may occur. The attached (junit) test reproduces the scenario in two ways: The 1st test succeeds, but the line number information for the outer interpreter is corrupted, the 2nd test throws the ArrayIndexOutOfBoundsException: --- org.mozilla.javascript.WrappedException: WrappedException of "oops" in inner line 4 [null] org.mozilla.javascript.WrappedException: WrappedException of "oops" in outer1 line 827 [null] org.mozilla.javascript.WrappedException: WrappedException of "oops" in inner line 4 [null] java.lang.ArrayIndexOutOfBoundsException at org.mozilla.javascript.Interpreter.getShort(Interpreter.java:1411) at org.mozilla.javascript.Interpreter.getSourcePositionFromStack(Interpreter.java:1817) at org.mozilla.javascript.Context.getSourcePositionFromStack(Context.java:2297) at org.mozilla.javascript.EvaluatorException.<init>(EvaluatorException.java:59) at org.mozilla.javascript.WrappedException.<init>(WrappedException.java:78) at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1604) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:191) at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:202) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2646) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:57) at rhinotestcase.ArrayOutOfBoundsRhinoTest.testArrayOutOfBoundsError2(ArrayOutOfBoundsRhinoTest.java:81) --- The attached patch fixes this behavior for me: --- org.mozilla.javascript.WrappedException: WrappedException of "oops" in inner line 4 [null] org.mozilla.javascript.WrappedException: WrappedException of "oops" in outer1 line 3 [null] org.mozilla.javascript.WrappedException: WrappedException of "oops" in inner line 4 [null] org.mozilla.javascript.WrappedException: WrappedException of "oops" in outer2 line 2 [null] --- The test was run against 1.5R5, with the .optimizer package removed.
added test case to reproduce problem
Attached patch patchSplinter Review
a patch that solves the problem for me
Attachment #168920 - Attachment is obsolete: true
The bug is already fixed in Rhino 1.6R1 as a part of work on bug 258844
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.6R1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: