From 4fb2bc38de4170d85b6327bd9e62f9f658007e86 Mon Sep 17 00:00:00 2001 From: Norihiro Kamae Date: Sun, 28 May 2023 00:50:46 +0900 Subject: [PATCH] text-freetype2: Fix crash after reaching buffer size The texbuf has a fixed size that won't expand. When a lot of multi-byte characters has arrived, it overflow and src_glyph becomes NULL. --- plugins/text-freetype2/text-functionality.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/text-freetype2/text-functionality.c b/plugins/text-freetype2/text-functionality.c index 7b4839d33..25772c50a 100644 --- a/plugins/text-freetype2/text-functionality.c +++ b/plugins/text-freetype2/text-functionality.c @@ -140,7 +140,8 @@ void set_up_vertex_buffer(struct ft2_source *srcdata) next_char:; glyph_index = FT_Get_Char_Index(srcdata->font_face, srcdata->text[i]); - word_width += src_glyph->xadv; + if (src_glyph) + word_width += src_glyph->xadv; eos_skip:; }