Changeset 95235 in webkit


Ignore:
Timestamp:
Sep 15, 2011 2:59:10 PM (13 years ago)
Author:
jchaffraix@webkit.org
Message:

Source/WebCore: Crash in RenderBox::paintMaskImages due to a mask without an associated image
https://bugs.webkit.org/show_bug.cgi?id=50151

Reviewed by Simon Fraser.

Test: fast/css/empty-webkit-mask-crash.html

The crash stems from the fact that FillLayer::hasImage would walk over the linked list
of FillLayers and return true if one had an image. This means that hasImage() is true
does not mean that image() is non-NULL on all FillLayers.

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::paintMaskImages): Simplify the logic by doing the hasImage() check up-front
and properly check image() for each FillLayers. This has the nice benefit of changing the complexity
from O(n2) to O(n), which was what the code expected anyway.

LayoutTests: Test for: Crash in RenderBox::paintMaskImages due to a mask without an associated image
https://bugs.webkit.org/show_bug.cgi?id=50151

Reviewed by Simon Fraser.

  • fast/css/empty-webkit-mask-crash-expected.png: Added.
  • fast/css/empty-webkit-mask-crash-expected.txt: Added.
  • fast/css/empty-webkit-mask-crash.html: Added.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r95228 r95235  
     12011-09-15  Julien Chaffraix  <jchaffraix@webkit.org>
     2
     3        Test for: Crash in RenderBox::paintMaskImages due to a mask without an associated image
     4        https://bugs.webkit.org/show_bug.cgi?id=50151
     5
     6        Reviewed by Simon Fraser.
     7
     8        * fast/css/empty-webkit-mask-crash-expected.png: Added.
     9        * fast/css/empty-webkit-mask-crash-expected.txt: Added.
     10        * fast/css/empty-webkit-mask-crash.html: Added.
     11
    1122011-09-15  Andy Estes  <aestes@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r95234 r95235  
     12011-09-15  Julien Chaffraix  <jchaffraix@webkit.org>
     2
     3        Crash in RenderBox::paintMaskImages due to a mask without an associated image
     4        https://bugs.webkit.org/show_bug.cgi?id=50151
     5
     6        Reviewed by Simon Fraser.
     7
     8        Test: fast/css/empty-webkit-mask-crash.html
     9
     10        The crash stems from the fact that FillLayer::hasImage would walk over the linked list
     11        of FillLayers and return true if one had an image. This means that hasImage() is true
     12        does not mean that image() is non-NULL on all FillLayers.
     13
     14        * rendering/RenderBox.cpp:
     15        (WebCore::RenderBox::paintMaskImages): Simplify the logic by doing the hasImage() check up-front
     16        and properly check image() for each FillLayers. This has the nice benefit of changing the complexity
     17        from O(n^2) to O(n), which was what the code expected anyway.
     18
    1192011-09-15  Eric Seidel  <eric@webkit.org>
    220
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r94912 r95235  
    950950            pushTransparencyLayer = true;
    951951
    952         if (maskBoxImage && maskLayers->hasImage()) {
     952        bool hasMaskLayerWithImage = maskLayers->hasImage();
     953        if (maskBoxImage && hasMaskLayerWithImage) {
    953954            // We have a mask-box-image and mask-image, so need to composite them together before using the result as a mask.
    954955            pushTransparencyLayer = true;
    955         } else {
     956        } else if (hasMaskLayerWithImage) {
    956957            // We have to use an extra image buffer to hold the mask. Multiple mask images need
    957958            // to composite together using source-over so that they can then combine into a single unified mask that
     
    962963            // before pushing the transparency layer.
    963964            for (const FillLayer* fillLayer = maskLayers->next(); fillLayer; fillLayer = fillLayer->next()) {
    964                 if (fillLayer->hasImage() && fillLayer->image()->canRender(style()->effectiveZoom())) {
     965                if (fillLayer->image() && fillLayer->image()->canRender(style()->effectiveZoom())) {
    965966                    pushTransparencyLayer = true;
    966967                    // We found one image that can be used in rendering, exit the loop
Note: See TracChangeset for help on using the changeset viewer.