From 8274e3e03443f69f30987361b470638167aa963b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 30 Nov 2019 00:15:54 +0100 Subject: [PATCH] font: never set glyph->cols to something that is less than 0 --- font.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/font.c b/font.c index e1c8b73d..9094b794 100644 --- a/font.c +++ b/font.c @@ -648,10 +648,13 @@ glyph_for_wchar(const struct font *font, wchar_t wc, struct glyph *glyph) pixman_image_set_filter(pix, PIXMAN_FILTER_BEST, NULL, 0); } + int cols = wcwidth(wc); + if (cols < 0) + cols = 0; *glyph = (struct glyph){ .wc = wc, - .cols = wcwidth(wc), + .cols = cols, .pix = pix, .x = font->face->glyph->bitmap_left * font->pixel_size_fixup, .y = font->face->glyph->bitmap_top * font->pixel_size_fixup,