From 2c9979d6a01b5fb4951f1413ad8468ed10415c64 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 1 May 2009 14:05:31 -0400 Subject: =?UTF-8?q?Bug=20580987=20=E2=80=93=20SIGFPE=20in=20pango=5Fglyph?= =?UTF-8?q?=5Fstring=5Findex=5Fto=5Fx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Be pedantic about broken cluster setup, avoid div-by-zero. --- pango/glyphstring.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pango/glyphstring.c b/pango/glyphstring.c index 8fb70313..2e3a9f80 100644 --- a/pango/glyphstring.c +++ b/pango/glyphstring.c @@ -506,6 +506,12 @@ pango_glyph_string_index_to_x (PangoGlyphString *glyphs, if (trailing) cluster_offset += 1; + if (G_UNLIKELY (!cluster_chars)) /* pedantic */ + { + *x_pos = start_xpos; + return; + } + *x_pos = ((cluster_chars - cluster_offset) * start_xpos + cluster_offset * end_xpos) / cluster_chars; } -- cgit v1.2.1