From 9b9be4f5deb9934db4781bb41eba4a9bfbaba880 Mon Sep 17 00:00:00 2001 From: Caleb Hearon Date: Sun, 24 Sep 2023 21:44:12 -0400 Subject: [PATCH] fix broken font matching due to a use-after-free f3184ba9da2737dbe25275631678a7ef5924fe6b introduced a use-after- free bug. Pango does not copy the string when you use the _static version of pango_font_description_set_family. Font selection was not working for me at all. --- src/register_font.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/register_font.cc b/src/register_font.cc index 37182c0ac..cc0af52d7 100644 --- a/src/register_font.cc +++ b/src/register_font.cc @@ -303,7 +303,7 @@ get_pango_font_description(unsigned char* filepath) { return NULL; } - pango_font_description_set_family_static(desc, family); + pango_font_description_set_family(desc, family); free(family); pango_font_description_set_weight(desc, get_pango_weight(table->usWeightClass)); pango_font_description_set_stretch(desc, get_pango_stretch(table->usWidthClass));