Title: [272543] branches/safari-611-branch
Revision
272543
Author
[email protected]
Date
2021-02-08 13:24:38 -0800 (Mon, 08 Feb 2021)

Log Message

Cherry-pick r271570. rdar://problem/74105714

    [JSC] GenericArguments<Type>::defineOwnProperty's assumption about error is not correct
    https://bugs.webkit.org/show_bug.cgi?id=220693
    <rdar://problem/72929171>

    Reviewed by Mark Lam.

    JSTests:

    * stress/freeze-invokes-out-of-memory.js: Added.
    (shouldThrow):

    Source/_javascript_Core:

    Any function taking JSGlobalObject* can cause out-of-memory error potentially. And we have a way to invoke it.
    But GenericArguments<Type>::defineOwnProperty didn't assume OutOfMemory error. This patch fixes it.

    * runtime/GenericArgumentsInlines.h:
    (JSC::GenericArguments<Type>::defineOwnProperty):

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-611-branch/JSTests/ChangeLog (272542 => 272543)


--- branches/safari-611-branch/JSTests/ChangeLog	2021-02-08 21:24:36 UTC (rev 272542)
+++ branches/safari-611-branch/JSTests/ChangeLog	2021-02-08 21:24:38 UTC (rev 272543)
@@ -1,5 +1,42 @@
 2021-02-08  Russell Epstein  <[email protected]>
 
+        Cherry-pick r271570. rdar://problem/74105714
+
+    [JSC] GenericArguments<Type>::defineOwnProperty's assumption about error is not correct
+    https://bugs.webkit.org/show_bug.cgi?id=220693
+    <rdar://problem/72929171>
+    
+    Reviewed by Mark Lam.
+    
+    JSTests:
+    
+    * stress/freeze-invokes-out-of-memory.js: Added.
+    (shouldThrow):
+    
+    Source/_javascript_Core:
+    
+    Any function taking JSGlobalObject* can cause out-of-memory error potentially. And we have a way to invoke it.
+    But GenericArguments<Type>::defineOwnProperty didn't assume OutOfMemory error. This patch fixes it.
+    
+    * runtime/GenericArgumentsInlines.h:
+    (JSC::GenericArguments<Type>::defineOwnProperty):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271570 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-17  Yusuke Suzuki  <[email protected]>
+
+            [JSC] GenericArguments<Type>::defineOwnProperty's assumption about error is not correct
+            https://bugs.webkit.org/show_bug.cgi?id=220693
+            <rdar://problem/72929171>
+
+            Reviewed by Mark Lam.
+
+            * stress/freeze-invokes-out-of-memory.js: Added.
+            (shouldThrow):
+
+2021-02-08  Russell Epstein  <[email protected]>
+
         Cherry-pick r270664. rdar://problem/74105714
 
     Align [[DefineOwnProperty]] method of mapped arguments object with the spec

Added: branches/safari-611-branch/JSTests/stress/freeze-invokes-out-of-memory.js (0 => 272543)


--- branches/safari-611-branch/JSTests/stress/freeze-invokes-out-of-memory.js	                        (rev 0)
+++ branches/safari-611-branch/JSTests/stress/freeze-invokes-out-of-memory.js	2021-02-08 21:24:38 UTC (rev 272543)
@@ -0,0 +1,24 @@
+function shouldThrow(func, errorMessage) {
+    var errorThrown = false;
+    var error = null;
+    try {
+        func();
+    } catch (e) {
+        errorThrown = true;
+        error = e;
+    }
+    if (!errorThrown)
+        throw new Error('not thrown');
+    if (String(error) !== errorMessage)
+        throw new Error(`bad error: ${String(error)}`);
+}
+
+function foo() {
+    Object.freeze(arguments);
+}
+
+let s = [0.1].toLocaleString().padEnd(2**31-1, 'ab');
+
+shouldThrow(() => {
+    foo(s);
+}, `RangeError: Out of memory`);

Modified: branches/safari-611-branch/Source/_javascript_Core/ChangeLog (272542 => 272543)


--- branches/safari-611-branch/Source/_javascript_Core/ChangeLog	2021-02-08 21:24:36 UTC (rev 272542)
+++ branches/safari-611-branch/Source/_javascript_Core/ChangeLog	2021-02-08 21:24:38 UTC (rev 272543)
@@ -1,5 +1,45 @@
 2021-02-08  Russell Epstein  <[email protected]>
 
+        Cherry-pick r271570. rdar://problem/74105714
+
+    [JSC] GenericArguments<Type>::defineOwnProperty's assumption about error is not correct
+    https://bugs.webkit.org/show_bug.cgi?id=220693
+    <rdar://problem/72929171>
+    
+    Reviewed by Mark Lam.
+    
+    JSTests:
+    
+    * stress/freeze-invokes-out-of-memory.js: Added.
+    (shouldThrow):
+    
+    Source/_javascript_Core:
+    
+    Any function taking JSGlobalObject* can cause out-of-memory error potentially. And we have a way to invoke it.
+    But GenericArguments<Type>::defineOwnProperty didn't assume OutOfMemory error. This patch fixes it.
+    
+    * runtime/GenericArgumentsInlines.h:
+    (JSC::GenericArguments<Type>::defineOwnProperty):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271570 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-17  Yusuke Suzuki  <[email protected]>
+
+            [JSC] GenericArguments<Type>::defineOwnProperty's assumption about error is not correct
+            https://bugs.webkit.org/show_bug.cgi?id=220693
+            <rdar://problem/72929171>
+
+            Reviewed by Mark Lam.
+
+            Any function taking JSGlobalObject* can cause out-of-memory error potentially. And we have a way to invoke it.
+            But GenericArguments<Type>::defineOwnProperty didn't assume OutOfMemory error. This patch fixes it.
+
+            * runtime/GenericArgumentsInlines.h:
+            (JSC::GenericArguments<Type>::defineOwnProperty):
+
+2021-02-08  Russell Epstein  <[email protected]>
+
         Cherry-pick r270664. rdar://problem/74105714
 
     Align [[DefineOwnProperty]] method of mapped arguments object with the spec

Modified: branches/safari-611-branch/Source/_javascript_Core/runtime/GenericArgumentsInlines.h (272542 => 272543)


--- branches/safari-611-branch/Source/_javascript_Core/runtime/GenericArgumentsInlines.h	2021-02-08 21:24:36 UTC (rev 272542)
+++ branches/safari-611-branch/Source/_javascript_Core/runtime/GenericArgumentsInlines.h	2021-02-08 21:24:38 UTC (rev 272543)
@@ -238,12 +238,12 @@
         }
 
         bool status = thisObject->defineOwnIndexedProperty(globalObject, index, newDescriptor, shouldThrow);
+        RETURN_IF_EXCEPTION(scope, false);
         if (!status) {
             ASSERT(!isMapped || thisObject->isModifiedArgumentDescriptor(index));
-            RELEASE_AND_RETURN(scope, false);
+            return false;
         }
 
-        scope.assertNoException();
         thisObject->setModifiedArgumentDescriptor(globalObject, index);
         RETURN_IF_EXCEPTION(scope, false);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to