<div dir="ltr"><div><span style="font-size:12.8000001907349px">Oops, my fault in not replying correction:</span></div><span style="font-size:12.8000001907349px"><div><span style="font-size:12.8000001907349px"><br></span></div>Alright, I've narrowed things down somewhat.  I've been building with "-ggdb -Og" to make sure it wasn't a case of excessive optimization.  This looks like it only appears when building with "--enable-static --disable-shared"  I hadn't put much thought into that fact since 2.9.1 builds fine and runs without any issues when configured and built exactly the same.  After 2.9.1, I have to have shared libs enabled or that crash creeps in.  </span><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">I've been using the static libs only so shared libs go unused and extraneous.  With the crash being caused by an unchecked reference and the same functionality restored once a check was put in, I didn't put much more thought into it.  I believe I saw something about it using shared libs' path to locate its config files which would explain why, when configured this way, 2.9.1 isn't able to find the default Windows fonts but it had never crashed as a result.  Naturally, if passed in a valid fontconfig path using the FONTCONFIG_PATH env variable, the default fonts are found in both versions and the crash naturally never takes place.  I only raised the issue due to the segfault itself, however.  The only code paths I noticed that didn't check for a null config were from when FcFontSetList and FcFontList make calls to FcInitBringUptoDate which wasn't checking for a null.  In every other function I saw, an explicit check was performed prior to its use.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 7, 2015 at 1:32 PM, Matt Breedlove <span dir="ltr"><<a href="mailto:breedlove.matt@gmail.com" target="_blank">breedlove.matt@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Alright, I've narrowed things down somewhat.  I've been building with "-ggdb -Og" to make sure it wasn't a case of excessive optimization.  This looks like it only appears when building with "--enable-static --disable-shared"  I hadn't put much thought into that fact since 2.9.1 builds fine and runs without any issues when configured and built exactly the same.  After 2.9.1, I have to have shared libs enabled or that crash creeps in.  <div><br></div><div>I've been using the static libs only so shared libs go unused and extraneous.  With the crash being caused by an unchecked reference and the same functionality restored once a check was put in, I didn't put much more thought into it.  I believe I saw something about it using shared libs' path to locate its config files which would explain why, when configured this way, 2.9.1 isn't able to find the default Windows fonts but it had never crashed as a result.  Naturally, if passed in a valid fontconfig path using the FONTCONFIG_PATH env variable, the default fonts are found in both versions and the crash naturally never takes place.  I only raised the issue due to the segfault itself, however.  The only code paths I noticed that didn't check for a null config were from when FcFontSetList and FcFontList make calls to FcInitBringUptoDate which wasn't checking for a null.  In every other function I saw, an explicit check was performed prior to its use.</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 7, 2015 at 11:20 AM, Matt Breedlove <span dir="ltr"><<a href="mailto:breedlove.matt@gmail.com" target="_blank">breedlove.matt@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I can take a further look into the code differences between 2.11.1 and 2.11.91 to see if I can pinpoint what  change may be causing it but after 2.11.1, it happens with consistency.  I haven't noticed any other problematic behavior elsewhere, though.  After putting that check into place, the two releases appear to function identically so I assumed 2.11.1 just bails out before ever reaching that point and some type of correction dealing with blank/invalid config's might have just been fixed allowing fc-list to finally reach this point in the code.</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 5, 2015 at 9:02 PM, Akira TAGOH <span dir="ltr"><<a href="mailto:akira@tagoh.org" target="_blank">akira@tagoh.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks. but how often does it happen? I think it's only when the memory allocation failed though.</div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Thu, Mar 5, 2015 at 10:36 PM, Matt Breedlove <span dir="ltr"><<a href="mailto:breedlove.matt@gmail.com" target="_blank">breedlove.matt@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div style="font-size:12.8000001907349px">Beginning with version 2.11.91 up to trunk:</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">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.</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">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.</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">mingw-w64 / gcc 4.92 / Windows 8.1 x64<br></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px"><br></div><div><div><span style="font-size:12.8000001907349px">diff --git a/src/fcinit.c b/src/fcinit.c</span></div><div><span style="font-size:12.8000001907349px">index db62c21..1315a52 100644</span></div><div><span style="font-size:12.8000001907349px">--- a/src/fcinit.c</span></div><div><span style="font-size:12.8000001907349px">+++ b/src/fcinit.c</span></div><div><span style="font-size:12.8000001907349px">@@ -209,6 +209,9 @@ FcInitBringUptoDate (void)</span></div><div><span style="font-size:12.8000001907349px">     FcConfig   *config = FcConfigGetCurrent ();</span></div><div><span style="font-size:12.8000001907349px">     time_t     now;</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">+    if (!config)</span></div><div><span style="font-size:12.8000001907349px">+        return FcFalse;</span></div><div><span style="font-size:12.8000001907349px">+</span></div><div><span style="font-size:12.8000001907349px">     /*</span></div><div><span style="font-size:12.8000001907349px">      * rescanInterval == 0 disables automatic up to date</span></div><div><span style="font-size:12.8000001907349px">      */</span></div><span><font color="#888888"><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Matt Breedlove</div></font></span></div></div>
<br></div></div>_______________________________________________<br>
Fontconfig mailing list<br>
<a href="mailto:Fontconfig@lists.freedesktop.org" target="_blank">Fontconfig@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/fontconfig" target="_blank">http://lists.freedesktop.org/mailman/listinfo/fontconfig</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div>Akira TAGOH</div>
</font></span></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>