diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-11-29 23:15:54 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-11-29 23:15:54 +0000 |
| commit | 8274e3e03443f69f30987361b470638167aa963b (patch) | |
| tree | 0e0d6bb27635534e77498ec9947241fa20a774e7 | |
| parent | vt: fix memory corruption: wcwidth() may return -1 (diff) | |
font: never set glyph->cols to something that is less than 0
| -rw-r--r-- | font.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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, |
