[pango/renderer-crash] renderer: Don't divide by zero




commit b823774b132e1cddd6e4a8a423761c5c15375753
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 21 19:08:32 2021 -0400

    renderer: Don't divide by zero
    
    Before dividing by num_glyphs in draw_strikethrough,
    make sure it isn't 0. This should fix reported crashes
    in this function.
    
    Fixes: #599

 pango/pango-renderer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index f575707f..21d09573 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -284,7 +284,7 @@ draw_strikethrough (PangoRenderer *renderer,
   PangoRectangle *rect = &state->strikethrough_rect;
   int num_glyphs = state->strikethrough_glyphs;
 
-  if (state->strikethrough)
+  if (state->strikethrough && num_glyphs > 0)
     pango_renderer_draw_rectangle (renderer,
                                    PANGO_RENDER_PART_STRIKETHROUGH,
                                    rect->x,


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