-
Notifications
You must be signed in to change notification settings - Fork 355
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
Hang for fake arrays with huge lengths #207
Comments
Testing this class of problem in the Chrome/Firefox consoles is tricky, since just typing/pasting the statement without pressing enter crashes the tab, since the console attempts to show a preview of the result as you type. Other functions which are similarly affected include:
I can't find any pathological behaviour for My suggestion is that all non-polyfilled functions (including the ones that apparently don't need it) have something like this added to the top of them:
Worth noting that this solution changes the behaviour in the case of a length getter:
In native JavaScript this hangs the thread (but is trying to return 0). In the current JS-Interpreter it promptly returns -1 (which is wrong). Under the proposed solution it would throw 'Error: Getter not supported in that context' which is consistent with us not supporting getters and setters on arrays. I think this change is positive. @cpcallen Can I get your LGTM on this approach, as well as your eyes on the equivalent parts of Code City? |
This adds support for getters and setters on arrays, while also eliminating infinite loops as detailed in issue #207
Filed this bug for V8: https://bugs.chromium.org/p/v8/issues/detail?id=11574 |
Filed another bug: https://bugs.chromium.org/p/v8/issues/detail?id=11579 |
Filed a bug for Mozilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1699351 |
The following takes forever to execute:
Array.prototype.lastIndexOf.call({0: true, length: 'Infinity'}, true);
This hangs all browsers, node, and the JS-Interpreter.
The text was updated successfully, but these errors were encountered: