Changeset 244136 in webkit


Ignore:
Timestamp:
Apr 10, 2019 11:05:00 AM (5 years ago)
Author:
rmorisset@apple.com
Message:

We should clear m_needsOverflowCheck when hitting an exception in defineProperties in ObjectConstructor.cpp
https://bugs.webkit.org/show_bug.cgi?id=196746

JSTests:

Reviewed by Yusuke Suzuki.

  • stress/cyclic-define-properties.js: Added.

(foo):

Source/JavaScriptCore:

Reviewed by Yusuke Suzuki..

It should be safe as in that case we are not completing the operation, and so not going to have any buffer overflow.

  • runtime/ObjectConstructor.cpp:

(JSC::defineProperties):

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r244079 r244136  
     12019-04-10  Robin Morisset  <rmorisset@apple.com>
     2
     3        We should clear m_needsOverflowCheck when hitting an exception in defineProperties in ObjectConstructor.cpp
     4        https://bugs.webkit.org/show_bug.cgi?id=196746
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        * stress/cyclic-define-properties.js: Added.
     9        (foo):
     10
    1112019-04-09  Saam barati  <sbarati@apple.com>
    212
  • trunk/Source/JavaScriptCore/ChangeLog

    r244114 r244136  
     12019-04-10  Robin Morisset  <rmorisset@apple.com>
     2
     3        We should clear m_needsOverflowCheck when hitting an exception in defineProperties in ObjectConstructor.cpp
     4        https://bugs.webkit.org/show_bug.cgi?id=196746
     5
     6        Reviewed by Yusuke Suzuki..
     7
     8        It should be safe as in that case we are not completing the operation, and so not going to have any buffer overflow.
     9
     10        * runtime/ObjectConstructor.cpp:
     11        (JSC::defineProperties):
     12
    1132019-04-10  Antoine Quint  <graouts@apple.com>
    214
  • trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp

    r242650 r244136  
    607607    Vector<PropertyDescriptor> descriptors;
    608608    MarkedArgumentBuffer markBuffer;
     609#define RETURN_IF_EXCEPTION_CLEARING_OVERFLOW(value) do { \
     610    if (scope.exception()) { \
     611        markBuffer.overflowCheckNotNeeded(); \
     612        return value; \
     613    } \
     614} while (false)
    609615    for (size_t i = 0; i < numProperties; i++) {
    610616        JSValue prop = properties->get(exec, propertyNames[i]);
    611         RETURN_IF_EXCEPTION(scope, { });
     617        RETURN_IF_EXCEPTION_CLEARING_OVERFLOW({ });
    612618        PropertyDescriptor descriptor;
    613         bool success = toPropertyDescriptor(exec, prop, descriptor);
    614         EXCEPTION_ASSERT(!scope.exception() || !success);
    615         if (UNLIKELY(!success)) {
    616             markBuffer.overflowCheckNotNeeded();
    617             return jsNull();
    618         }
     619        toPropertyDescriptor(exec, prop, descriptor);
     620        RETURN_IF_EXCEPTION_CLEARING_OVERFLOW({ });
    619621        descriptors.append(descriptor);
    620622        // Ensure we mark all the values that we're accumulating
     
    629631    }
    630632    RELEASE_ASSERT(!markBuffer.hasOverflowed());
     633#undef RETURN_IF_EXCEPTION_CLEARING_OVERFLOW
    631634    for (size_t i = 0; i < numProperties; i++) {
    632635        auto& propertyName = propertyNames[i];
Note: See TracChangeset for help on using the changeset viewer.