Fix assertion failure in the freetype backend

https://bugzilla.redhat.com/show_bug.cgi?id=1567633
This commit is contained in:
Kalev Lember 2018-04-21 23:14:22 +02:00
parent 82463d240a
commit 8450f09a0d
2 changed files with 59 additions and 3 deletions

View File

@ -0,0 +1,51 @@
From 7554822dd0b52d33ec7898e81b59e97164b00142 Mon Sep 17 00:00:00 2001
From: Uli Schlachter <psychon@znc.in>
Date: Sat, 21 Apr 2018 09:37:06 +0200
Subject: [PATCH] Fix assertion failure in the freetype backend
Fonts are kept in a hash table, so when creating a new font, the code
first checks the hash table for an already-existing entry and only then
is a new instance really created. There is an assert that checks that
the key used for the hash table lookup is the same as the instance that
is created later has, because otherwise the hash table was checked
incorrectly.
This assert failed in some conditions.
Fix this by fixing some places that initialised ft hash keys in a wrong
way.
Patch by Behdad Esfahbod and submitted via bugzilla.
Source: https://bugs.freedesktop.org/show_bug.cgi?id=105746#c4
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=105746
Signed-off-by: Uli Schlachter <psychon@znc.in>
---
src/cairo-ft-font.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 79aef78f5b0d..9b10708988d7 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -445,7 +445,7 @@ _cairo_ft_unscaled_font_init (cairo_ft_unscaled_font_t *unscaled,
if (from_face) {
unscaled->from_face = TRUE;
- _cairo_ft_unscaled_font_init_key (unscaled, TRUE, NULL, face->face_index, face);
+ _cairo_ft_unscaled_font_init_key (unscaled, TRUE, NULL, id, face);
unscaled->have_color = FT_HAS_COLOR (face) != 0;
@@ -640,7 +640,7 @@ static cairo_status_t
_cairo_ft_unscaled_font_create_from_face (FT_Face face,
cairo_ft_unscaled_font_t **out)
{
- return _cairo_ft_unscaled_font_create_internal (TRUE, NULL, 0, face, out);
+ return _cairo_ft_unscaled_font_create_internal (TRUE, NULL, face->face_index, face, out);
}
static cairo_bool_t
--
2.17.0

View File

@ -11,13 +11,16 @@
Name: cairo Name: cairo
Version: 1.15.12 Version: 1.15.12
Release: 1%{?dist} Release: 2%{?dist}
Summary: A 2D graphics library Summary: A 2D graphics library
License: LGPLv2 or MPLv1.1 License: LGPLv2 or MPLv1.1
URL: http://cairographics.org URL: http://cairographics.org
Source0: http://cairographics.org/snapshots/%{name}-%{version}.tar.xz Source0: http://cairographics.org/snapshots/%{name}-%{version}.tar.xz
# Backported from upstream
Patch0: 0001-Fix-assertion-failure-in-the-freetype-backend.patch
Patch3: cairo-multilib.patch Patch3: cairo-multilib.patch
BuildRequires: pkgconfig BuildRequires: pkgconfig
@ -88,8 +91,7 @@ This package contains tools for working with the cairo graphics library.
* cairo-trace: Record cairo library calls for later playback * cairo-trace: Record cairo library calls for later playback
%prep %prep
%setup -q %autosetup -p1
%patch3 -p1 -b .multilib
%build %build
%configure --disable-static \ %configure --disable-static \
@ -173,6 +175,9 @@ find $RPM_BUILD_ROOT -name '*.la' -delete
%{_libdir}/cairo/ %{_libdir}/cairo/
%changelog %changelog
* Sat Apr 21 2018 Kalev Lember <klember@redhat.com> - 1.15.12-2
- Fix assertion failure in the freetype backend (#1567633)
* Thu Apr 12 2018 Kalev Lember <klember@redhat.com> - 1.15.12-1 * Thu Apr 12 2018 Kalev Lember <klember@redhat.com> - 1.15.12-1
- Update to 1.15.12 - Update to 1.15.12