diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2009-05-01 14:05:31 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2009-05-01 14:05:31 -0400 |
commit | 2c9979d6a01b5fb4951f1413ad8468ed10415c64 (patch) | |
tree | 2669736d0b22c9b35c1b6587f10b8bc100880413 /pango/glyphstring.c | |
parent | 150573e610c0b14c34aba6fe17b1a6e36d282767 (diff) | |
download | pango-2c9979d6a01b5fb4951f1413ad8468ed10415c64.tar.gz |
Bug 580987 – SIGFPE in pango_glyph_string_index_to_x
Be pedantic about broken cluster setup, avoid div-by-zero.
Diffstat (limited to 'pango/glyphstring.c')
-rw-r--r-- | pango/glyphstring.c | 6 |
1 files changed, 6 insertions, 0 deletions
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; } |