Title: [182015] trunk/Source/WebCore
Revision
182015
Author
[email protected]
Date
2015-03-26 10:29:53 -0700 (Thu, 26 Mar 2015)

Log Message

Crash when laying out (char)0
https://bugs.webkit.org/show_bug.cgi?id=143103

Reviewed by Dean Jackson.

We currently cache a character -> Font mapping in a HashMap.
However, keys in Hashmaps can't be 0. This patch simply skips
the cache in this case.

No new tests, for now. I'm having trouble creating a test because
the site that causes this bug generates their page using script,
and the script is all minified, and difficult to understand. I
will contact the owner of the site and ask for and unminified
version of their sources. However, I don't want to that to block
this tiny fix from going in.

* platform/graphics/Font.cpp:
(WebCore::Font::systemFallbackFontForCharacter):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (182014 => 182015)


--- trunk/Source/WebCore/ChangeLog	2015-03-26 17:24:21 UTC (rev 182014)
+++ trunk/Source/WebCore/ChangeLog	2015-03-26 17:29:53 UTC (rev 182015)
@@ -1,3 +1,24 @@
+2015-03-26  Myles C. Maxfield  <[email protected]>
+
+        Crash when laying out (char)0
+        https://bugs.webkit.org/show_bug.cgi?id=143103
+
+        Reviewed by Dean Jackson.
+
+        We currently cache a character -> Font mapping in a HashMap.
+        However, keys in Hashmaps can't be 0. This patch simply skips
+        the cache in this case.
+
+        No new tests, for now. I'm having trouble creating a test because
+        the site that causes this bug generates their page using script,
+        and the script is all minified, and difficult to understand. I
+        will contact the owner of the site and ask for and unminified
+        version of their sources. However, I don't want to that to block
+        this tiny fix from going in.
+
+        * platform/graphics/Font.cpp:
+        (WebCore::Font::systemFallbackFontForCharacter):
+
 2015-03-26  Jer Noble  <[email protected]>
 
         [Mac][EME] Crash at com.apple.WebCore: WebCore::CDMSessionMediaSourceAVFObjC::releaseKeys + 177

Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (182014 => 182015)


--- trunk/Source/WebCore/platform/graphics/Font.cpp	2015-03-26 17:24:21 UTC (rev 182014)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp	2015-03-26 17:29:53 UTC (rev 182015)
@@ -415,6 +415,11 @@
 {
     auto fontAddResult = systemFallbackCache().add(this, CharacterFallbackMap());
 
+    if (!character) {
+        UChar codeUnit = 0;
+        return FontCache::singleton().systemFallbackForCharacters(description, this, isForPlatformFont, &codeUnit, 1);
+    }
+
     auto key = std::make_pair(character, isForPlatformFont);
     auto characterAddResult = fontAddResult.iterator->value.add(key, nullptr);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to