Title: [243128] trunk/Source/_javascript_Core
Revision
243128
Author
[email protected]
Date
2019-03-18 20:00:26 -0700 (Mon, 18 Mar 2019)

Log Message

[JSC] Add missing exception checks revealed by newly added exception checks, follow-up after r243081
https://bugs.webkit.org/show_bug.cgi?id=195927

Reviewed by Mark Lam.

r243081 adds more exception checks which are previously missing, and it reveals missing exception checks in the caller.
This patch is a follow-up patch after r243081, adding missing exception checks more to fix debug test failures.

* runtime/RegExpConstructor.cpp:
(JSC::setRegExpConstructorInput):
(JSC::setRegExpConstructorMultiline):
* runtime/RegExpGlobalData.cpp:
(JSC::RegExpGlobalData::getBackref):
(JSC::RegExpGlobalData::getLastParen):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (243127 => 243128)


--- trunk/Source/_javascript_Core/ChangeLog	2019-03-19 02:21:10 UTC (rev 243127)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-03-19 03:00:26 UTC (rev 243128)
@@ -1,5 +1,22 @@
 2019-03-18  Yusuke Suzuki  <[email protected]>
 
+        [JSC] Add missing exception checks revealed by newly added exception checks, follow-up after r243081
+        https://bugs.webkit.org/show_bug.cgi?id=195927
+
+        Reviewed by Mark Lam.
+
+        r243081 adds more exception checks which are previously missing, and it reveals missing exception checks in the caller.
+        This patch is a follow-up patch after r243081, adding missing exception checks more to fix debug test failures.
+
+        * runtime/RegExpConstructor.cpp:
+        (JSC::setRegExpConstructorInput):
+        (JSC::setRegExpConstructorMultiline):
+        * runtime/RegExpGlobalData.cpp:
+        (JSC::RegExpGlobalData::getBackref):
+        (JSC::RegExpGlobalData::getLastParen):
+
+2019-03-18  Yusuke Suzuki  <[email protected]>
+
         [JSC] Generator should not create JSLexicalEnvironment if it is not necessary
         https://bugs.webkit.org/show_bug.cgi?id=195901
 

Modified: trunk/Source/_javascript_Core/runtime/RegExpConstructor.cpp (243127 => 243128)


--- trunk/Source/_javascript_Core/runtime/RegExpConstructor.cpp	2019-03-19 02:21:10 UTC (rev 243127)
+++ trunk/Source/_javascript_Core/runtime/RegExpConstructor.cpp	2019-03-19 03:00:26 UTC (rev 243128)
@@ -150,9 +150,13 @@
 bool setRegExpConstructorInput(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue value)
 {
     VM& vm = exec->vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
     if (auto constructor = jsDynamicCast<RegExpConstructor*>(vm, JSValue::decode(thisValue))) {
+        auto* string = JSValue::decode(value).toString(exec);
+        RETURN_IF_EXCEPTION(scope, { });
+        scope.release();
         JSGlobalObject* globalObject = constructor->globalObject(vm);
-        globalObject->regExpGlobalData().setInput(exec, globalObject, JSValue::decode(value).toString(exec));
+        globalObject->regExpGlobalData().setInput(exec, globalObject, string);
         return true;
     }
     return false;
@@ -161,9 +165,13 @@
 bool setRegExpConstructorMultiline(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue value)
 {
     VM& vm = exec->vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
     if (auto constructor = jsDynamicCast<RegExpConstructor*>(vm, JSValue::decode(thisValue))) {
+        bool multiline = JSValue::decode(value).toBoolean(exec);
+        RETURN_IF_EXCEPTION(scope, { });
+        scope.release();
         JSGlobalObject* globalObject = constructor->globalObject(vm);
-        globalObject->regExpGlobalData().setMultiline(JSValue::decode(value).toBoolean(exec));
+        globalObject->regExpGlobalData().setMultiline(multiline);
         return true;
     }
     return false;

Modified: trunk/Source/_javascript_Core/runtime/RegExpGlobalData.cpp (243127 => 243128)


--- trunk/Source/_javascript_Core/runtime/RegExpGlobalData.cpp	2019-03-19 02:21:10 UTC (rev 243127)
+++ trunk/Source/_javascript_Core/runtime/RegExpGlobalData.cpp	2019-03-19 03:00:26 UTC (rev 243128)
@@ -43,6 +43,7 @@
 
     if (i < array->length()) {
         JSValue result = JSValue(array).get(exec, i);
+        RETURN_IF_EXCEPTION(scope, { });
         ASSERT(result.isString() || result.isUndefined());
         if (!result.isUndefined())
             return result;
@@ -61,6 +62,7 @@
     unsigned length = array->length();
     if (length > 1) {
         JSValue result = JSValue(array).get(exec, length - 1);
+        RETURN_IF_EXCEPTION(scope, { });
         ASSERT(result.isString() || result.isUndefined());
         if (!result.isUndefined())
             return result;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to