diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-08-21 19:08:32 -0400 |
---|---|---|
committer | Kalev Lember <klember@redhat.com> | 2021-08-25 14:28:39 +0200 |
commit | 71e39443b5e97fd5e8952c42369c9f59b3f393e3 (patch) | |
tree | 753ef77702d41fc543d230839436d33f4787606d | |
parent | c704c8b7e096dd3d3fd684463ef0e7860c2c2db3 (diff) | |
download | pango-71e39443b5e97fd5e8952c42369c9f59b3f393e3.tar.gz |
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
-rw-r--r-- | pango/pango-renderer.c | 2 |
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, |