From b823774b132e1cddd6e4a8a423761c5c15375753 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 21 Aug 2021 19:08:32 -0400 Subject: 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, -- cgit v1.2.1