NeilFraser / JS-Interpreter

A sandboxed JavaScript interpreter in JavaScript.
Apache License 2.0
1.98k stars 353 forks source link

Infinit loop #183

Closed XmiliaH closed 4 years ago

XmiliaH commented 4 years ago

It is possible to get an infinit loop with:

var scope = {};

// The next line will set scope.parentScope to the global scope
with(scope) {

    // This will set scope.parentScope to scope
    with(scope) {

        // Will result in an infinit loop in getValueFromScope
        loop;
    }
}
NeilFraser commented 4 years ago

@cpcallen Confirm that C.C. is unaffected (no 'with' support)?

NeilFraser commented 4 years ago

I think PR #185 is the correct way to resolve this. It's a rather significant change, so I want to test this a bit more.