From 5f3a780614ee76347fd0692439fe37a7fc02602e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 23 Nov 2022 16:45:46 -0700 Subject: [PATCH] [font] Protect against div-by-zero --- src/hb-font.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hb-font.cc b/src/hb-font.cc index e1699ca2a..704c16086 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -628,9 +628,10 @@ hb_font_get_glyph_shape_default (hb_font_t *font, hb_font_get_glyph_shape_default_adaptor_t adaptor = { draw_funcs, draw_data, - (float) font->x_scale / (float) font->parent->x_scale, - (float) font->y_scale / (float) font->parent->y_scale, - (font->slant - font->parent->slant) * (float) font->x_scale / (float) font->parent->y_scale + font->parent->x_scale ? (float) font->x_scale / (float) font->parent->x_scale : 0.f, + font->parent->y_scale ? (float) font->y_scale / (float) font->parent->y_scale : 0.f, + font->parent->y_scale ? (font->slant - font->parent->slant) * + (float) font->x_scale / (float) font->parent->y_scale : 0.f }; font->parent->get_glyph_shape (glyph,