Title: [148758] trunk/Source/WebCore
Revision
148758
Author
[email protected]
Date
2013-04-19 12:45:22 -0700 (Fri, 19 Apr 2013)

Log Message

WebKit should not decode or support PDF favicons
https://bugs.webkit.org/show_bug.cgi?id=114650
<rdar://problem/10133914>

Reviewed by Dan Bernstein.

Drop the image data on the floor if it begins with the PDF magic number.
No other browser I can find on OS X supports PDF favicons (by experimentation),
and we do not properly display them.

* loader/icon/IconLoader.cpp:
(WebCore::IconLoader::notifyFinished):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (148757 => 148758)


--- trunk/Source/WebCore/ChangeLog	2013-04-19 19:00:14 UTC (rev 148757)
+++ trunk/Source/WebCore/ChangeLog	2013-04-19 19:45:22 UTC (rev 148758)
@@ -1,3 +1,18 @@
+2013-04-19  Tim Horton  <[email protected]>
+
+        WebKit should not decode or support PDF favicons
+        https://bugs.webkit.org/show_bug.cgi?id=114650
+        <rdar://problem/10133914>
+
+        Reviewed by Dan Bernstein.
+
+        Drop the image data on the floor if it begins with the PDF magic number.
+        No other browser I can find on OS X supports PDF favicons (by experimentation),
+        and we do not properly display them.
+
+        * loader/icon/IconLoader.cpp:
+        (WebCore::IconLoader::notifyFinished):
+
 2013-04-19  Martin Robinson  <[email protected]>
 
         Remove the OpenVG backend

Modified: trunk/Source/WebCore/loader/icon/IconLoader.cpp (148757 => 148758)


--- trunk/Source/WebCore/loader/icon/IconLoader.cpp	2013-04-19 19:00:14 UTC (rev 148757)
+++ trunk/Source/WebCore/loader/icon/IconLoader.cpp	2013-04-19 19:45:22 UTC (rev 148758)
@@ -96,6 +96,14 @@
     if (status && (status < 200 || status > 299))
         data = ""
 
+    static const char pdfMagicNumber[] = "%PDF";
+    static unsigned pdfMagicNumberLength = sizeof(pdfMagicNumber) - 1;
+    WTFLogAlways("%d\n", pdfMagicNumberLength);
+    if (data && data->size() >= pdfMagicNumberLength && !memcmp(data->data(), pdfMagicNumber, pdfMagicNumberLength)) {
+        LOG(IconDatabase, "IconLoader::finishLoading() - Ignoring icon at %s because it appears to be a PDF", resource->url().string().ascii().data());
+        data = ""
+    }
+
     LOG(IconDatabase, "IconLoader::finishLoading() - Committing iconURL %s to database", resource->url().string().ascii().data());
     m_frame->loader()->icon()->commitToDatabase(resource->url());
     // Setting the icon data only after committing to the database ensures that the data is
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to