Title: [238407] releases/WebKitGTK/webkit-2.22/Source/WebCore
Revision
238407
Author
mcatanz...@igalia.com
Date
2018-11-20 15:38:23 -0800 (Tue, 20 Nov 2018)

Log Message

Segfaults on https://terminalizer.com/
https://bugs.webkit.org/show_bug.cgi?id=191805

Patch by Zan Dobersek <zdober...@igalia.com> on 2018-11-20
Reviewed by Michael Catanzaro.

In HarfBuzzFace, the CacheEntry's HashMap object that caches Unicode
codepoints and their corresponding glyph indices should allow zero
values as valid keys since zero is a valid Unicode codepoint.

This change enables properly caching zero codepoints, avoiding
repetitive additions to the HashMap cache that end up in a crash.

* platform/graphics/harfbuzz/HarfBuzzFace.h: Move the elongated
GlyphCache type alias to the public section of HarfBuzzFace class
declaration, making it reusable in the helper HarfBuzzFontData struct.
* platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog (238406 => 238407)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog	2018-11-20 22:09:23 UTC (rev 238406)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog	2018-11-20 23:38:23 UTC (rev 238407)
@@ -1,3 +1,22 @@
+2018-11-20  Zan Dobersek  <zdober...@igalia.com>
+
+        Segfaults on https://terminalizer.com/
+        https://bugs.webkit.org/show_bug.cgi?id=191805
+
+        Reviewed by Michael Catanzaro.
+
+        In HarfBuzzFace, the CacheEntry's HashMap object that caches Unicode
+        codepoints and their corresponding glyph indices should allow zero
+        values as valid keys since zero is a valid Unicode codepoint.
+
+        This change enables properly caching zero codepoints, avoiding
+        repetitive additions to the HashMap cache that end up in a crash.
+
+        * platform/graphics/harfbuzz/HarfBuzzFace.h: Move the elongated
+        GlyphCache type alias to the public section of HarfBuzzFace class
+        declaration, making it reusable in the helper HarfBuzzFontData struct.
+        * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
+
 2018-11-18  Zan Dobersek  <zdober...@igalia.com>
 
         HarfBuzzFace::CacheEntry should use 32-bit values in its HashMap

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFace.h (238406 => 238407)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFace.h	2018-11-20 22:09:23 UTC (rev 238406)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFace.h	2018-11-20 23:38:23 UTC (rev 238407)
@@ -57,11 +57,10 @@
 
     void setScriptForVerticalGlyphSubstitution(hb_buffer_t*);
 
+    using GlyphCache = HashMap<uint32_t, uint32_t, DefaultHash<uint32_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint32_t>>;
 private:
     class CacheEntry : public RefCounted<CacheEntry> {
     public:
-        using GlyphCache = HashMap<uint32_t, uint32_t>;
-
         static Ref<CacheEntry> create(hb_face_t* face)
         {
             return adoptRef(*new CacheEntry(face));

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp (238406 => 238407)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp	2018-11-20 22:09:23 UTC (rev 238406)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp	2018-11-20 23:38:23 UTC (rev 238407)
@@ -50,7 +50,7 @@
 namespace WebCore {
 
 struct HarfBuzzFontData {
-    WTF::HashMap<uint32_t, uint32_t>& glyphCacheForFaceCacheEntry;
+    HarfBuzzFace::GlyphCache& glyphCacheForFaceCacheEntry;
     RefPtr<cairo_scaled_font_t> cairoScaledFont;
 };
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to