[Fontconfig] Segfault within fc-list when not provided with a valid configuration

Matt Breedlove breedlove.matt at gmail.com
Thu Mar 5 05:36:31 PST 2015

Beginning with version 2.11.91 up to trunk:

In fcinit.c, the FcInitBringUptoDate function doesn't properly validate the
return value for FcConfigGetCurrent() leading to a segfault when attempting
to reference config->rescanInterval.

fc-list suffers from this problem and crashes as a result when not provided
with a valid fontconfig file.  Versions prior to 2.11.91 don't exhibit the
same behavior.

mingw-w64 / gcc 4.92 / Windows 8.1 x64

diff --git a/src/fcinit.c b/src/fcinit.c
index db62c21..1315a52 100644
--- a/src/fcinit.c
+++ b/src/fcinit.c
@@ -209,6 +209,9 @@ FcInitBringUptoDate (void)
     FcConfig   *config = FcConfigGetCurrent ();
     time_t     now;

+    if (!config)
+        return FcFalse;
      * rescanInterval == 0 disables automatic up to date

Matt Breedlove
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/fontconfig/attachments/20150305/cde76d3c/attachment.html>

More information about the Fontconfig mailing list