Title: [91961] trunk/Source/WebKit2
Revision
91961
Author
ander...@apple.com
Date
2011-07-28 17:06:33 -0700 (Thu, 28 Jul 2011)

Log Message

Crash when trying to encode FontInfo with a null font attribute descriptor
https://bugs.webkit.org/show_bug.cgi?id=65350
<rdar://problem/9520670>

* Shared/FontInfo.cpp:
(WebKit::FontInfo::encode):
Encode a boolean specifying whether there's a fontAttributeDictionary member variable.

(WebKit::FontInfo::decode):
Don't try to decode the fontAttributeDictionary member variable if none has been encoded.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (91960 => 91961)


--- trunk/Source/WebKit2/ChangeLog	2011-07-29 00:02:30 UTC (rev 91960)
+++ trunk/Source/WebKit2/ChangeLog	2011-07-29 00:06:33 UTC (rev 91961)
@@ -1,3 +1,16 @@
+2011-07-28  Anders Carlsson  <ander...@apple.com>
+
+        Crash when trying to encode FontInfo with a null font attribute descriptor
+        https://bugs.webkit.org/show_bug.cgi?id=65350
+        <rdar://problem/9520670>
+
+        * Shared/FontInfo.cpp:
+        (WebKit::FontInfo::encode):
+        Encode a boolean specifying whether there's a fontAttributeDictionary member variable.
+
+        (WebKit::FontInfo::decode):
+        Don't try to decode the fontAttributeDictionary member variable if none has been encoded.
+
 2011-07-26  Chris Fleizach  <cfleiz...@apple.com>
 
         REGRESSION (Safari 5.1): _javascript_ dialogs not usable with VoiceOver

Modified: trunk/Source/WebKit2/Shared/FontInfo.cpp (91960 => 91961)


--- trunk/Source/WebKit2/Shared/FontInfo.cpp	2011-07-29 00:02:30 UTC (rev 91960)
+++ trunk/Source/WebKit2/Shared/FontInfo.cpp	2011-07-29 00:06:33 UTC (rev 91961)
@@ -37,13 +37,22 @@
 void FontInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
 {
 #if PLATFORM(MAC)
-    CoreIPC::encode(encoder, fontAttributeDictionary.get());
+    encoder->encode(static_cast<bool>(fontAttributeDictionary));
+    if (fontAttributeDictionary)
+        CoreIPC::encode(encoder, fontAttributeDictionary.get());
 #endif
 }
 
 bool FontInfo::decode(CoreIPC::ArgumentDecoder* decoder, FontInfo& fontInfo)
 {    
 #if PLATFORM(MAC)
+    bool hasFontAttributeDictionary;
+    if (!decoder->decode(hasFontAttributeDictionary))
+        return false;
+
+    if (!hasFontAttributeDictionary)
+        return true;
+
     if (!CoreIPC::decode(decoder, fontInfo.fontAttributeDictionary))
         return false;
 #endif

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm (91960 => 91961)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm	2011-07-29 00:02:30 UTC (rev 91960)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm	2011-07-29 00:06:33 UTC (rev 91961)
@@ -37,6 +37,7 @@
 
 void WebPopupMenu::setUpPlatformData(const IntRect&, PlatformPopupMenuData& data)
 {
+    // FIXME: font will be nil here for custom fonts, we should fix that.
     NSFont *font = m_popupClient->menuStyle().font().primaryFont()->getNSFont();
     if (!font)
         return;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to