[pango] Bug 580987 – SIGFPE in pango_glyph_string_index_to_x



commit 2c9979d6a01b5fb4951f1413ad8468ed10415c64
Author: Behdad Esfahbod <behdad behdad org>
Date:   Fri May 1 14:05:31 2009 -0400

    Bug 580987 â?? SIGFPE in pango_glyph_string_index_to_x
    
    Be pedantic about broken cluster setup, avoid div-by-zero.
---
 pango/glyphstring.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/pango/glyphstring.c b/pango/glyphstring.c
index 8fb7031..2e3a9f8 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;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]