Title: [130268] trunk/Source/WebKit/chromium
Revision
130268
Author
[email protected]
Date
2012-10-03 02:48:40 -0700 (Wed, 03 Oct 2012)

Log Message

WebImage::framesFromData should skip corrupted frames
https://bugs.webkit.org/show_bug.cgi?id=98214

Patch by Peter Kotwicz <[email protected]> on 2012-10-03
Reviewed by Adam Barth.

WebImage::framesFromData() should only return bitmaps for valid frames
of a .ico file.

* src/WebImageSkia.cpp:
(WebKit::WebImage::framesFromData):
* tests/WebImageTest.cpp:
(WebKit::TEST):
(WebKit):
* tests/data/valid_header_missing_bitmap.ico: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (130267 => 130268)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-10-03 09:45:35 UTC (rev 130267)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-10-03 09:48:40 UTC (rev 130268)
@@ -1,3 +1,20 @@
+2012-10-03  Peter Kotwicz  <[email protected]>
+
+        WebImage::framesFromData should skip corrupted frames
+        https://bugs.webkit.org/show_bug.cgi?id=98214
+
+        Reviewed by Adam Barth.
+
+        WebImage::framesFromData() should only return bitmaps for valid frames
+        of a .ico file.
+
+        * src/WebImageSkia.cpp:
+        (WebKit::WebImage::framesFromData):
+        * tests/WebImageTest.cpp:
+        (WebKit::TEST):
+        (WebKit):
+        * tests/data/valid_header_missing_bitmap.ico: Added.
+
 2012-10-02  Yury Semikhatsky  <[email protected]>
 
         Provide memory instrumentation for HashCountedSet

Modified: trunk/Source/WebKit/chromium/src/WebImageSkia.cpp (130267 => 130268)


--- trunk/Source/WebKit/chromium/src/WebImageSkia.cpp	2012-10-03 09:45:35 UTC (rev 130267)
+++ trunk/Source/WebKit/chromium/src/WebImageSkia.cpp	2012-10-03 09:48:40 UTC (rev 130268)
@@ -125,7 +125,7 @@
             continue;
 
         OwnPtr<NativeImageSkia> image = adoptPtr(frame->asNewNativeImage());
-        if (image.get())
+        if (image.get() && image->isDataComplete())
             frames.append(WebImage(image->bitmap()));
     }
 

Modified: trunk/Source/WebKit/chromium/tests/WebImageTest.cpp (130267 => 130268)


--- trunk/Source/WebKit/chromium/tests/WebImageTest.cpp	2012-10-03 09:45:35 UTC (rev 130267)
+++ trunk/Source/WebKit/chromium/tests/WebImageTest.cpp	2012-10-03 09:48:40 UTC (rev 130268)
@@ -88,6 +88,15 @@
     EXPECT_EQ(SkColorSetARGB(255, 0, 0, 0), images[1].getSkBitmap().getColor(0, 0));
 }
 
+TEST(WebImageTest, ICOValidHeaderMissingBitmap)
+{
+    RefPtr<SharedBuffer> data = ""
+    ASSERT_TRUE(data.get());
+
+    WebVector<WebImage> images = WebImage::framesFromData(WebData(data));
+    ASSERT_TRUE(images.isEmpty());
+}
+
 TEST(WebImageTest, BadImage)
 {
     const char badImage[] = "hello world";

Added: trunk/Source/WebKit/chromium/tests/data/valid_header_missing_bitmap.ico (0 => 130268)


--- trunk/Source/WebKit/chromium/tests/data/valid_header_missing_bitmap.ico	                        (rev 0)
+++ trunk/Source/WebKit/chromium/tests/data/valid_header_missing_bitmap.ico	2012-10-03 09:48:40 UTC (rev 130268)
@@ -0,0 +1 @@
+ h6
Property changes on: trunk/Source/WebKit/chromium/tests/data/valid_header_missing_bitmap.ico
___________________________________________________________________

Added: svn:executable

_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to