]> git.wh0rd.org - fontconfig.git/commit
Avoid crashes if config files contain junk.
authorMike FABIAN <mfabian@suse.de>
Thu, 18 Oct 2007 12:44:28 +0000 (05:44 -0700)
committerKeith Packard <keithp@koto.keithp.com>
Thu, 18 Oct 2007 12:44:28 +0000 (05:44 -0700)
commit07e646cc8422bda778ecf1c084129556a39a0f2a
tree3675d891d001e6df58d76b31534043e28105f087
parentfa9a7448d83da498b3494fd0ff7d756569f94425
Avoid crashes if config files contain junk.

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.

The problem was caused by partially truncated expression trees caused by
parse errors -- typechecking these walked the tree without verifying the
integrity of the structure. Of course, the whole tree will be discarded
shortly after being loaded as it contained an error.
src/fcxml.c