Don't crash if we fail to parse a builtin
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Feb 2016 22:42:02 +0000 (22:42 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Feb 2016 22:42:02 +0000 (22:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=154047
rdar://problem/24300617

Reviewed by Mark Lam.

Crashing probably seemed like a good idea at the time, but we could get here in case of a
near stack overflow, so that the parser bails because of recursion.

* parser/Parser.h:
(JSC::parse):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196337 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/parser/Parser.h

index 80375ce..4a656cb 100644 (file)
@@ -1,3 +1,17 @@
+2016-02-09  Filip Pizlo  <fpizlo@apple.com>
+
+        Don't crash if we fail to parse a builtin
+        https://bugs.webkit.org/show_bug.cgi?id=154047
+        rdar://problem/24300617
+
+        Reviewed by Mark Lam.
+
+        Crashing probably seemed like a good idea at the time, but we could get here in case of a
+        near stack overflow, so that the parser bails because of recursion.
+
+        * parser/Parser.h:
+        (JSC::parse):
+
 2016-02-07  Gavin Barraclough  <barraclough@apple.com>
 
         GetValueFunc/PutValueFunc should not take both slotBase and thisValue
index 3787637..6f0e390 100644 (file)
@@ -1542,8 +1542,8 @@ std::unique_ptr<ParsedNode> parse(
         if (builtinMode == JSParserBuiltinMode::Builtin) {
             if (!result)
                 WTF::dataLog("Error compiling builtin: ", error.message(), "\n");
-            RELEASE_ASSERT(result);
-            result->setClosedVariables(parser.closedVariables());
+            else
+                result->setClosedVariables(parser.closedVariables());
         }
         return result;
     }