]> granicus.if.org Git - libass/commitdiff
fontselect: fix NULL dereference
authorStefano Pigozzi <stefano.pigozzi@gmail.com>
Tue, 29 Apr 2014 19:58:49 +0000 (21:58 +0200)
committerGrigori Goronzy <greg@chown.ath.cx>
Fri, 10 Jul 2015 08:42:40 +0000 (10:42 +0200)
Apparently on some broken fonts, FreeType can return a NULL family name. Avoid
to crash in these cases.

libass/ass_fontselect.c

index 398d8f9aea26bffbbb3463287a4be62d4cd23daf..bc1dec53c9b7790e5a999836cc9feaded17338eb 100644 (file)
@@ -640,7 +640,7 @@ get_font_info(FT_Library lib, FT_Face face, ASS_FontProviderMetaData *info)
     iconv_close(utf16to8);
 
     // check if we got a valid family - if not use whatever FreeType gives us
-    if (num_family == 0) {
+    if (num_family == 0 && face->family_name) {
         families[0] = strdup(face->family_name);
         num_family++;
     }