summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-08-21 19:08:32 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-08-21 19:09:52 -0400
commitb823774b132e1cddd6e4a8a423761c5c15375753 (patch)
treebf704cadf11e946d8b6d93e5c867983049e12e09
parentf72ff7d4752318b48e3dd0db83a2ef0300aa898f (diff)
downloadpango-b823774b132e1cddd6e4a8a423761c5c15375753.tar.gz
renderer: Don't divide by zerorenderer-crash
Before dividing by num_glyphs in draw_strikethrough, make sure it isn't 0. This should fix reported crashes in this function. Fixes: #599
-rw-r--r--pango/pango-renderer.c2
1 files changed, 1 insertions, 1 deletions
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,