Changeset 248722 in webkit


Ignore:
Timestamp:
Aug 15, 2019 10:20:20 AM (5 years ago)
Author:
Antti Koivisto
Message:

Negative size box with border radius causes hang under WebCore::approximateAsRegion
https://bugs.webkit.org/show_bug.cgi?id=200769
<rdar://problem/53380674>

Reviewed by Alex Christensen.

Source/WebCore:

If a box's width or height computes negative the rounded border rect will also be negative.
This caused near-infinite loop during rounded border region approximation.

Test: fast/css/border-radius-negative-size.html

  • platform/graphics/RoundedRect.cpp:

(WebCore::approximateAsRegion):

Bail out if the region is empty (which includes negative sizes).
For safety also limit the number of rectangles we generate for corner arc approximation.

LayoutTests:

  • fast/css/border-radius-negative-size-expected.txt: Added.
  • fast/css/border-radius-negative-size.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r248718 r248722  
     12019-08-15  Antti Koivisto  <antti@apple.com>
     2
     3        Negative size box with border radius causes hang under WebCore::approximateAsRegion
     4        https://bugs.webkit.org/show_bug.cgi?id=200769
     5        <rdar://problem/53380674>
     6
     7        Reviewed by Alex Christensen.
     8
     9        * fast/css/border-radius-negative-size-expected.txt: Added.
     10        * fast/css/border-radius-negative-size.html: Added.
     11
    1122019-08-15  Youenn Fablet  <youenn@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r248721 r248722  
     12019-08-15  Antti Koivisto  <antti@apple.com>
     2
     3        Negative size box with border radius causes hang under WebCore::approximateAsRegion
     4        https://bugs.webkit.org/show_bug.cgi?id=200769
     5        <rdar://problem/53380674>
     6
     7        Reviewed by Alex Christensen.
     8
     9        If a box's width or height computes negative the rounded border rect will also be negative.
     10        This caused near-infinite loop during rounded border region approximation.
     11
     12        Test: fast/css/border-radius-negative-size.html
     13
     14        * platform/graphics/RoundedRect.cpp:
     15        (WebCore::approximateAsRegion):
     16
     17        Bail out if the region is empty (which includes negative sizes).
     18        For safety also limit the number of rectangles we generate for corner arc approximation.
     19
    1202019-08-15  Thibault Saunier  <tsaunier@igalia.com>
    221
  • trunk/Source/WebCore/platform/graphics/RoundedRect.cpp

    r243680 r248722  
    311311    Region region;
    312312
     313    if (roundedRect.isEmpty())
     314        return region;
     315
    313316    auto& rect = roundedRect.rect();
    314317    region.unite(enclosingIntRect(rect));
     
    333336        auto count = (arcLengthFactor + (stepLength / 2)) / stepLength;
    334337
     338        constexpr auto maximumCount = 20u;
     339        count = std::min(maximumCount, count);
     340
    335341        for (auto i = 0u; i < count; ++i) {
    336342            auto angle = fromAngle + (i + 1) * (toAngle - fromAngle) / (count + 1);
Note: See TracChangeset for help on using the changeset viewer.