2009-06-17 Brent Fulgham <bfulgham@webkit.org>
authorbfulgham@webkit.org <bfulgham@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Jun 2009 18:25:14 +0000 (18:25 +0000)
committerbfulgham@webkit.org <bfulgham@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Jun 2009 18:25:14 +0000 (18:25 +0000)
        Reviewed by Gustavo Noronha Silva.

        Fixes: https://bugs.webkit.org/show_bug.cgi?id=26470.
        The use of zero-width or zero-height rectangles in generating
        gradients caused Windows Cairo to crash, and webkitgtk to
        produce invalid images.

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

WebCore/ChangeLog
WebCore/platform/graphics/cairo/ImageCairo.cpp

index 7571a99..6c5d9ec 100644 (file)
@@ -1,3 +1,21 @@
+2009-06-17  Brent Fulgham  <bfulgham@webkit.org>
+
+        Reviewed by Gustavo Noronha.
+
+        Fixes: https://bugs.webkit.org/show_bug.cgi?id=26470.
+        The use of zero-width or zero-height rectangles in generating
+        gradients caused Windows Cairo to crash, and webkitgtk to
+        produce invalid images.
+
+        We now test for NaN in the phase argument, which is calculated
+        using fmodf and can blow up when the width/height values passed
+        are zero.
+
+        Test: fast/gradients/border-image-gradient-sides-and-corners.html
+
+        * platform/graphics/cairo/ImageCairo.cpp:
+        (WebCore::Image::drawPattern):
+
 2009-06-17  Ojan Vafai  <ojan@chromium.org>
 
         Reviewed by Dimitri Glazkov.
index 7c34e6f..0a3479c 100644 (file)
@@ -157,6 +157,10 @@ void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, con
     if (!image) // If it's too early we won't have an image yet.
         return;
 
+    // Avoid NaN
+    if (!isfinite(phase.x()) || !isfinite(phase.y()))
+       return;
+
     cairo_t* cr = context->platformContext();
     context->save();