2010-12-09 Yong Li <yoli@rim.com>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Dec 2010 18:26:54 +0000 (18:26 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Dec 2010 18:26:54 +0000 (18:26 +0000)
        Reviewed by Darin Adler.

        Check the return value of ImageBuffer::create()
        to avoid crash when ImageBuffer::create() fails.
        https://bugs.webkit.org/show_bug.cgi?id=50631

        No new test because it relies on the platform implementation
        of ImageBuffer. It is hard to make ImageBuffer::create() fail
        in most ports.

        * platform/graphics/GeneratedImage.cpp:
        (WebCore::GeneratedImage::drawPattern):

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

WebCore/ChangeLog
WebCore/platform/graphics/GeneratedImage.cpp

index dc2838e..2a50842 100644 (file)
@@ -1,3 +1,18 @@
+2010-12-09  Yong Li  <yoli@rim.com>
+
+        Reviewed by Darin Adler.
+
+        Check the return value of ImageBuffer::create()
+        to avoid crash when ImageBuffer::create() fails.
+        https://bugs.webkit.org/show_bug.cgi?id=50631
+
+        No new test because it relies on the platform implementation
+        of ImageBuffer. It is hard to make ImageBuffer::create() fail
+        in most ports.
+
+        * platform/graphics/GeneratedImage.cpp:
+        (WebCore::GeneratedImage::drawPattern):
+
 2010-12-09  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Dan Bernstein.
 2010-12-09  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Dan Bernstein.
index 5df2608..f2c175b 100644 (file)
@@ -57,7 +57,8 @@ void GeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcR
 
     // Create a BitmapImage and call drawPattern on it.
     OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(adjustedSize);
 
     // Create a BitmapImage and call drawPattern on it.
     OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(adjustedSize);
-    ASSERT(imageBuffer.get());
+    if (!imageBuffer)
+        return;
 
     // Fill with the gradient.
     GraphicsContext* graphicsContext = imageBuffer->context();
 
     // Fill with the gradient.
     GraphicsContext* graphicsContext = imageBuffer->context();