]> granicus.if.org Git - libass/commitdiff
fontconfig: fix error checking
authorwm4 <wm4@nowhere>
Fri, 28 Aug 2015 12:02:19 +0000 (14:02 +0200)
committerwm4 <wm4@nowhere>
Fri, 28 Aug 2015 12:07:06 +0000 (14:07 +0200)
FcInitLoadConfig() could faul, leaving rc=1 and fc->config=NULL, making
FcConfigBuildFonts() potentially crash.

Also, the FcConfigBuildFonts() return value was not checked.

libass/ass_fontconfig.c

index 50ce6c5bc70f768776153b959cf6c615febd8d58..0c89d36ec1ce3f9a8098fa1c5ae79b411c9fd3db 100644 (file)
@@ -271,10 +271,9 @@ ass_fontconfig_add_provider(ASS_Library *lib, ASS_FontSelector *selector,
                 "file found, using fallback.");
         FcConfigDestroy(fc->config);
         fc->config = FcInitLoadConfig();
-        rc++;
     }
-    if (rc)
-        FcConfigBuildFonts(fc->config);
+    if (fc->config)
+        rc = FcConfigBuildFonts(fc->config);
 
     if (!rc || !fc->config) {
         ass_msg(lib, MSGL_FATAL,