Closed Bug 301488 Opened 19 years ago Closed 19 years ago

StackOverflowError when FEATURE_MEMBER_EXPR_AS_FUNCTION_NAME is enabled

Categories

(Rhino Graveyard :: Compiler, defect)

1.6R1
x86
Windows Server 2003
defect
Not set
major

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 299539

People

(Reporter: slash, Assigned: igor)

Details

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)
Build Identifier: 1_6R1

I was debugging the Rhino trying to find the problem described in bug #289294 
and it seems that it's somewhere in method 
NodeTransformer.transformCompilationUnit_r(), probably in the block
case Token.RETURN: {...}. I haven't found the exact reason, but realized that 
it's related to processing of the "finally" blocks. Then I modified my JS 
source so that it contains the try/finally block. Now Rhino doesn't get stuck 
in infinite loop, but throws the following:
java.lang.StackOverflowError
	at org.mozilla.javascript.NodeTransformer.transformCompilationUnit_r
(NodeTransformer.java:76)
	at org.mozilla.javascript.NodeTransformer.transformCompilationUnit_r
(NodeTransformer.java:300)
	at org.mozilla.javascript.NodeTransformer.transformCompilationUnit_r
(NodeTransformer.java:300)
	at org.mozilla.javascript.NodeTransformer.transformCompilationUnit_r
(NodeTransformer.java:300)
	at org.mozilla.javascript.NodeTransformer.transformCompilationUnit_r
(NodeTransformer.java:300)
	at org.mozilla.javascript.NodeTransformer.transformCompilationUnit_r
(NodeTransformer.java:300)
	at org.mozilla.javascript.NodeTransformer.transformCompilationUnit_r
(NodeTransformer.java:300)
	at org.mozilla.javascript.NodeTransformer.transformCompilationUnit_r
(NodeTransformer.java:300)
	at org.mozilla.javascript.NodeTransformer.transformCompilationUnit_r
(NodeTransformer.java:300)
	at org.mozilla.javascript.NodeTransformer.transformCompilationUnit_r
(NodeTransformer.java:300)
	at org.mozilla.javascript.NodeTransformer.transformCompilationUnit_r
(NodeTransformer.java:300)
... and many more ...



Reproducible: Always

Steps to Reproduce:
1. Compile and run the following class:

import org.mozilla.javascript.*;

public class RhinoTry1 {
    public static class IEContextFactory extends ContextFactory
    {
        public static void init() {
            ContextFactory.initGlobal( new IEContextFactory() );
        }

        public boolean hasFeature( Context cx, int featureIndex ) {
            return featureIndex == 
Context.FEATURE_MEMBER_EXPR_AS_FUNCTION_NAME ?
                   true : super.hasFeature( cx, featureIndex );
        }
    }

    public static void main(String args[])
    {
        IEContextFactory.init();
        Context ctx = Context.enter();
        Scriptable scope = ctx.initStandardObjects( );
        ctx.evaluateString( scope, "var o = new Object(); function o.f() { try 
{ return } finally { ; } } ", "1", 1, null );
    }


Actual Results:  
java.lang.StackOverflowError

Expected Results:  
no exceptions, at least
Version: other → 1.6R1

*** This bug has been marked as a duplicate of 299539 ***
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.