Re: weird crash with fontconfig 2.3.92

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mike FABIAN <mfabian@xxxxxxx> さんは書きました:

> Mike FABIAN <mfabian@xxxxxxx> さんは書きました:
>
>> mfabian@magellan:~$ fc-match "foo:\\_\\_DUMMY\\_\\_=1"
>> Segmentation fault (core dumped)
>> mfabian@magellan:~$
>>
>> occurs with fontconfig 2.4 CVS branch checked out on December 6th 2005.

Still happens with fontconfig 2.3.93.20060103 (2.4 CVS branch checked
out yesterday).

Dirk Müller and me both made a patch to fix the problem.  Dirk already
posted his patch to the fontconfig mailing list a while ago, but this
mail never arrived. Therefore I attach both my and Dirk's patch here
again.

I am not sure which patch is better, both fix the crash but the
behaviour is different.

With Dirk's patch:

    mfabian@magellan:~$ fc-match "Luxi Mono:\\_\\_DUMMY\\_\\_=1"
    hgjgbbmp.ttc: "HGPGothicB" "Regular"
    mfabian@magellan:~$ fc-match "Luxi Mono"
    luximr.ttf: "Luxi Mono" "Regular"
    mfabian@magellan:~$ fc-match sans
    hgjgbbmp.ttc: "HGPGothicB" "Regular"
    mfabian@magellan:~$

I.e. with Dirk's patch the complete pattern is ignored when it
contains __DUMMY__ and a new empty pattern is created which gives the
same result as when trying to match "sans".

With my patch:

    mfabian@magellan:~$ fc-match "Luxi Mono:\\_\\_DUMMY\\_\\_=1"
    luximr.ttf: "Luxi Mono" "Regular"
    mfabian@magellan:~$ fc-match "Luxi Mono"
    luximr.ttf: "Luxi Mono" "Regular"
    mfabian@magellan:~$ fc-match sans
    hgjgbbmp.ttc: "HGPGothicB" "Regular"
    mfabian@magellan:~$

only __DUMMY__ is ignored, the rest of the pattern is used.
I.e. with my patch it behaves the same way as if I add
other junk into the pattern like:

    mfabian@magellan:~$ fc-match "Luxi Mono:nonsense=1"
    luximr.ttf: "Luxi Mono" "Regular"
    mfabian@magellan:~$

Here "nonsense=1" is ignored as well.

I still don't know for what purpose this __DUMMY__ in fcname.c line 33
has been introduced.

diff -ru fontconfig-2.3.93.20051222.orig/src/fcname.c fontconfig-2.3.93.20051222/src/fcname.c
--- fontconfig-2.3.93.20051222.orig/src/fcname.c	2005-12-21 16:47:42.000000000 +0100
+++ fontconfig-2.3.93.20051222/src/fcname.c	2005-12-23 17:55:04.000000000 +0100
@@ -703,7 +703,7 @@
 		for (;;)
 		{
 		    name = FcNameFindNext (name, ":,", save, &delim);
-		    if (t)
+		    if (t && strcmp(t->object, "__DUMMY__"))
 		    {
 			v = FcNameConvert (t->type, save, &m);
 			if (!FcPatternAdd (pat, t->object, v, FcTrue))
diff -ru fontconfig-2.3.93.20060103.orig/fc-match/fc-match.c fontconfig-2.3.93.20060103/fc-match/fc-match.c
--- fontconfig-2.3.93.20060103.orig/fc-match/fc-match.c	2005-11-24 21:32:30.000000000 +0100
+++ fontconfig-2.3.93.20060103/fc-match/fc-match.c	2006-01-04 19:42:42.000000000 +0100
@@ -131,7 +131,8 @@
     }
     if (argv[i])
 	pat = FcNameParse ((FcChar8 *) argv[i]);
-    else
+
+    if (!pat)
 	pat = FcPatternCreate ();
 
     FcConfigSubstitute (0, pat, FcMatchPattern);
-- 
Mike FABIAN   <mfabian@xxxxxxx>   http://www.suse.de/~mfabian
睡眠不足はいい仕事の敵だ。
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux