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

Changeset 240061 in webkit


Ignore:
Timestamp:
Jan 16, 2019, 3:27:09 PM (8 years ago)
Author:
Alan Coon
Message:

Cherry-pick r239833. rdar://problem/47260274

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):

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

Location:
branches/safari-607-branch/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-607-branch/Source/WebCore/ChangeLog

    r240058 r240061  
     12019-01-15  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r239833. rdar://problem/47260274
     4
     5    Safari Crashing in Version 12.0.1 (14606.2.104.1.1) WebCore::GraphicsLayerCA::updateBackdropFilters
     6    https://bugs.webkit.org/show_bug.cgi?id=193309
     7    <rdar://problem/45279224>
     8   
     9    Reviewed by Antoine Quint.
     10   
     11    A speculative fix for a CheckedArithmetic crash triggered in updateBackdropFilters.
     12   
     13    The crash log indicates we crash in a Checked<> class that is not recording
     14    overflow i.e. it is crashing due to an overflow. The only place in this function
     15    where that could happen is when we convert the FloatRect for the backdrop
     16    region into a Checked<unsigned> for width and height. This suggests that either
     17    the width or height are negative, or the float values are too large for integers,
     18    or the product of the two overflows.
     19   
     20    Avoid this by using RecordOverflow, but also changing the code a little to
     21    bail if the rectangle is incorrect.
     22   
     23    * platform/graphics/ca/GraphicsLayerCA.cpp:
     24    (WebCore::GraphicsLayerCA::updateBackdropFilters):
     25   
     26    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239833 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     27
     28    2019-01-09  Dean Jackson  <dino@apple.com>
     29
     30            Safari Crashing in Version 12.0.1 (14606.2.104.1.1) WebCore::GraphicsLayerCA::updateBackdropFilters
     31            https://bugs.webkit.org/show_bug.cgi?id=193309
     32            <rdar://problem/45279224>
     33
     34            Reviewed by Antoine Quint.
     35
     36            A speculative fix for a CheckedArithmetic crash triggered in updateBackdropFilters.
     37
     38            The crash log indicates we crash in a Checked<> class that is not recording
     39            overflow i.e. it is crashing due to an overflow. The only place in this function
     40            where that could happen is when we convert the FloatRect for the backdrop
     41            region into a Checked<unsigned> for width and height. This suggests that either
     42            the width or height are negative, or the float values are too large for integers,
     43            or the product of the two overflows.
     44
     45            Avoid this by using RecordOverflow, but also changing the code a little to
     46            bail if the rectangle is incorrect.
     47
     48            * platform/graphics/ca/GraphicsLayerCA.cpp:
     49            (WebCore::GraphicsLayerCA::updateBackdropFilters):
     50
    1512019-01-15  Alan Coon  <alancoon@apple.com>
    252
  • branches/safari-607-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r239461 r240061  
    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.