⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 239833 in webkit


Ignore:
Timestamp:
Jan 10, 2019, 10:08:23 AM (8 years ago)
Author:
dino@apple.com
Message:

Safari Crashing in Version 12.0.1 (14606.2.104.1.1) WebCore::GraphicsLayerCA::updateBackdropFilters
​https://bugs.webkit.org/show_bug.cgi?id=193309
<rdar://problem/45279224>

Reviewed by Antoine Quint.

A speculative fix for a CheckedArithmetic crash triggered in updateBackdropFilters.

The crash log indicates we crash in a Checked<> class that is not recording
overflow i.e. it is crashing due to an overflow. The only place in this function
where that could happen is when we convert the FloatRect for the backdrop
region into a Checked<unsigned> for width and height. This suggests that either
the width or height are negative, or the float values are too large for integers,
or the product of the two overflows.

Avoid this by using RecordOverflow, but also changing the code a little to
bail if the rectangle is incorrect.

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::updateBackdropFilters):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r239831 r239833  
     12019-01-09  Dean Jackson  <dino@apple.com>
     2
     3        Safari Crashing in Version 12.0.1 (14606.2.104.1.1) WebCore::GraphicsLayerCA::updateBackdropFilters
     4        https://bugs.webkit.org/show_bug.cgi?id=193309
     5        <rdar://problem/45279224>
     6
     7        Reviewed by Antoine Quint.
     8
     9        A speculative fix for a CheckedArithmetic crash triggered in updateBackdropFilters.
     10
     11        The crash log indicates we crash in a Checked<> class that is not recording
     12        overflow i.e. it is crashing due to an overflow. The only place in this function
     13        where that could happen is when we convert the FloatRect for the backdrop
     14        region into a Checked<unsigned> for width and height. This suggests that either
     15        the width or height are negative, or the float values are too large for integers,
     16        or the product of the two overflows.
     17
     18        Avoid this by using RecordOverflow, but also changing the code a little to
     19        bail if the rectangle is incorrect.
     20
     21        * platform/graphics/ca/GraphicsLayerCA.cpp:
     22        (WebCore::GraphicsLayerCA::updateBackdropFilters):
     23
    1242019-01-10  Oriol Brufau  <obrufau@igalia.com>
    225
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r239461 r239833  
    21482148void GraphicsLayerCA::updateBackdropFilters(CommitState& commitState)
    21492149{
     2150    using CheckedUnsigned = Checked<unsigned, RecordOverflow>;
     2151
    21502152    bool canHaveBackdropFilters = needsBackdrop();
    21512153
    21522154    if (canHaveBackdropFilters) {
    2153         Checked<unsigned, RecordOverflow> backdropFilterArea = Checked<unsigned>(static_cast<int>(m_backdropFiltersRect.rect().width())) * Checked<unsigned>(static_cast<int>(m_backdropFiltersRect.rect().height()));
    2154         if (backdropFilterArea.hasOverflowed())
    2155             canHaveBackdropFilters = false;
    2156         else {
    2157             Checked<unsigned, RecordOverflow> newTotalBackdropFilterArea = Checked<unsigned, RecordOverflow>(commitState.totalBackdropFilterArea) + backdropFilterArea;
    2158             if (newTotalBackdropFilterArea.hasOverflowed() || newTotalBackdropFilterArea.unsafeGet() > cMaxTotalBackdropFilterArea)
    2159                 canHaveBackdropFilters = false;
    2160             else
    2161                 commitState.totalBackdropFilterArea = newTotalBackdropFilterArea.unsafeGet();
     2155        canHaveBackdropFilters = false;
     2156        IntRect backdropFilterRect = enclosingIntRect(m_backdropFiltersRect.rect());
     2157        if (backdropFilterRect.width() > 0 && backdropFilterRect.height() > 0) {
     2158            CheckedUnsigned backdropFilterArea = CheckedUnsigned(backdropFilterRect.width()) * CheckedUnsigned(backdropFilterRect.height());
     2159            if (!backdropFilterArea.hasOverflowed()) {
     2160                CheckedUnsigned newTotalBackdropFilterArea = CheckedUnsigned(commitState.totalBackdropFilterArea) + backdropFilterArea;
     2161                if (!newTotalBackdropFilterArea.hasOverflowed() && newTotalBackdropFilterArea.unsafeGet() <= cMaxTotalBackdropFilterArea) {
     2162                    commitState.totalBackdropFilterArea = newTotalBackdropFilterArea.unsafeGet();
     2163                    canHaveBackdropFilters = true;
     2164                }
     2165            }
    21622166        }
    21632167    }
Note: See TracChangeset for help on using the changeset viewer.