Skip to content

Commit

Permalink
[FreeType] Problem under WebCore::FontPlatformData::FontPlatformData
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=191595

Unofficially reviewed stable branch commit.

Blacklist cairo 1.15 and 1.16.0 when setting FreeType memory allocation functions. These
broken versions of cairo free memory allocated by FreeType with system free. We can avoid
trouble by using the system allocator instead of bmalloc.

* platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
(WebCore::initializeFreeTypeLibrary):
  • Loading branch information
mcatanzaro committed Nov 21, 2018
1 parent 3aff2c8 commit 029b22c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,17 @@
2018-11-21 Michael Catanzaro <mcatanzaro@igalia.com>

[FreeType] Problem under WebCore::FontPlatformData::FontPlatformData
https://bugs.webkit.org/show_bug.cgi?id=191595

Unofficially reviewed stable branch commit.

Blacklist cairo 1.15 and 1.16.0 when setting FreeType memory allocation functions. These
broken versions of cairo free memory allocated by FreeType with system free. We can avoid
trouble by using the system allocator instead of bmalloc.

* platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
(WebCore::initializeFreeTypeLibrary):

2018-11-20 Zan Dobersek <zdobersek@igalia.com>

Segfaults on https://terminalizer.com/
Expand Down
Expand Up @@ -66,6 +66,13 @@ static bool initializeFreeTypeLibrary(FT_Library& library)
// https://www.freetype.org/freetype2/docs/design/design-4.html
// https://lists.nongnu.org/archive/html/freetype-devel/2004-10/msg00022.html

// Workaround crash in cairo 1.16.0. See https://webkit.org/b/191595.
int version = cairo_version();
if (version >= CAIRO_VERSION_ENCODE(1, 15, 0) && version < CAIRO_VERSION_ENCODE(1, 16, 1)) {
FT_Init_FreeType(&library);
return true;
}

FT_Memory memory = bitwise_cast<FT_Memory>(ft_smalloc(sizeof(*memory)));
if (!memory)
return false;
Expand Down

0 comments on commit 029b22c

Please sign in to comment.