Skip to content

turing completeness leak #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dominictarr opened this issue Mar 12, 2015 · 1 comment
Closed

turing completeness leak #4

dominictarr opened this issue Mar 12, 2015 · 1 comment

Comments

@dominictarr
Copy link

hey I found a gap where you can get at Function and then create code full non static code.

var evaluate = require('./');
var parse = require('esprima').parse;

var src = '(function () {}).constructor("var l = 3; while(l--) console.log(l); console.log(Date.now()); arguments.callee()")()';
var ast = parse(src).body[0].expression;
var res = evaluate(ast); //RangeError from stack overflow

console.log(res)

here is the output:

2
1
0
1426154732632
2
1
0
1426154732632
2
1
...
RangeError: Maximum call stack size exceeded

as you would expect.

It's somewhat harder to prevent turing completeness than it is to create it.
@matt- matt- mentioned this issue Oct 5, 2017
@ghost
Copy link

ghost commented Oct 5, 2017

Fixed in 2.0.0.

@ghost ghost closed this as completed Oct 5, 2017
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant