RESOLVED FIXED 180139
[ESNext] Enables a way to throw an error on ByteCodeGenerator step
https://bugs.webkit.org/show_bug.cgi?id=180139
Summary [ESNext] Enables a way to throw an error on ByteCodeGenerator step
Caio Lima
Reported 2017-11-29 05:56:56 PST
When generating bytecode into ByteCodeGenerator, we aren't considering cases where we doesn't have memory for constants like String. The same is true for BigInt, but we could throw OOM instead of use RELEASE_ASSERT in such cases. Here is a sample of program that crashes due to OOM. ``` var longStr = "f"; for (var i = 0; i < 30; ++i) longStr = longStr + longStr; let sub = longStr.substring(0, longStr.length - 4) let mscript = "0x" + longStr + sub + "n"; eval(mscript); ```
Attachments
Patch (4.35 KB, patch)
2020-01-16 16:33 PST, Robin Morisset
no flags
Robin Morisset
Comment 1 2020-01-16 16:33:19 PST
Robin Morisset
Comment 2 2020-01-16 16:34:25 PST
Mark Lam
Comment 3 2020-01-16 16:48:03 PST
Comment on attachment 387982 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387982&action=review r=me > Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:125 > + return generator.emitThrowExpressionTooDeepException(); It's hokey that we use "ExpressionTooDeepException" to mean OutOfMemoryError. Maybe we should change this later (in another patch) especially now that we're using in a case that has nothing to do with recursing into nested expressions.
WebKit Commit Bot
Comment 4 2020-01-16 23:16:40 PST
Comment on attachment 387982 [details] Patch Clearing flags on attachment: 387982 Committed r254738: <https://trac.webkit.org/changeset/254738>
WebKit Commit Bot
Comment 5 2020-01-16 23:16:41 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 6 2020-01-16 23:17:16 PST
Note You need to log in before you can comment on or make changes to this bug.