Backport a patch to fix SIGFPE in pango_layout_iter_get_char_extents() (#1036351)

This commit is contained in:
Akira TAGOH 2014-01-22 20:06:18 +09:00
parent 66dc247dd5
commit 82cb3fe103
2 changed files with 42 additions and 1 deletions

35
pango-fix-sigfpe.patch Normal file
View File

@ -0,0 +1,35 @@
From a6c318ee505aeabe6f84e1543d68834b9e0e7acf Mon Sep 17 00:00:00 2001
From: Behdad Esfahbod <behdad@behdad.org>
Date: Sun, 15 Dec 2013 18:42:17 -0500
Subject: [PATCH] Bug 720379 - SIGFPE in pango_layout_iter_get_char_extents()
Untested.
---
pango/pango-layout.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index a024d11..607a5f0 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -6178,8 +6178,15 @@ pango_layout_iter_get_char_extents (PangoLayoutIter *iter,
return;
}
- x0 = (iter->character_position * cluster_rect.width) / iter->cluster_num_chars;
- x1 = ((iter->character_position + 1) * cluster_rect.width) / iter->cluster_num_chars;
+ if (iter->cluster_num_chars)
+ {
+ x0 = (iter->character_position * cluster_rect.width) / iter->cluster_num_chars;
+ x1 = ((iter->character_position + 1) * cluster_rect.width) / iter->cluster_num_chars;
+ }
+ else
+ {
+ x0 = x1 = 0;
+ }
logical_rect->width = x1 - x0;
logical_rect->height = cluster_rect.height;
--
1.8.4.2

View File

@ -10,7 +10,7 @@
Summary: System for layout and rendering of internationalized text
Name: pango
Version: 1.36.1
Release: 1%{?dist}
Release: 2%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
#VCS: git:git://git.gnome.org/pango
@ -35,6 +35,8 @@ BuildRequires: cairo-gobject-devel
# Bootstrap requirements
BuildRequires: gnome-common intltool gtk-doc
Patch0: %{name}-fix-sigfpe.patch
%description
Pango is a library for laying out and rendering of text, with an emphasis
on internationalization. Pango can be used anywhere that text layout is needed,
@ -72,6 +74,7 @@ the functionality of the installed %{name} package.
%prep
%setup -q -n pango-%{version}
%patch0 -p1 -b .0-sigfpe
%build
@ -155,6 +158,9 @@ fi
%changelog
* Wed Jan 22 2014 Akira TAGOH <tagoh@redhat.com> - 1.36.1-2
- Backport a patch to fix SIGFPE in pango_layout_iter_get_char_extents() (#1036351)
* Thu Nov 14 2013 Richard Hughes <rhughes@redhat.com> - 1.36.1-1
- Update to 1.36.1