Patch: avoid crashes is config files contain junk

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

 



If ~/.fonts.conf contains:

  <edit mode="assign_replace" name="spacing">
   <int>mono</int>
  </edit>


fontconfig crashes:

    mfabian@magellan:~$ fc-match sans
    Fontconfig error: "~/.fonts.conf", line 46: "mono": not a valid integer
    セグメンテーション違反です (core dumped)
    mfabian@magellan:~$

Of course the above is nonsense, “mono” is no valid integer indeed.

But I think nevertheless fontconfig should not crash in that case.

A patch is attached. 

-- 
Mike FABIAN   <mfabian@xxxxxxx>   http://www.suse.de/~mfabian
睡眠不足はいい仕事の敵だ。
I � Unicode

diff -ru fontconfig-2.4.2.orig/src/fcxml.c fontconfig-2.4.2/src/fcxml.c
--- fontconfig-2.4.2.orig/src/fcxml.c	2006-12-02 22:54:03.000000000 +0100
+++ fontconfig-2.4.2/src/fcxml.c	2007-02-21 17:13:37.000000000 +0100
@@ -557,6 +557,9 @@
 {
     const FcObjectType	*o;
     const FcConstant	*c;
+
+    if (!expr)
+	return;
     
     switch (expr->op) {
     case FcOpInteger:
_______________________________________________
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