[Fontconfig] [PATCH] fc-list: Exit with an error for invalid patterns

W. Trevor King wking at tremily.us
Mon Sep 23 21:06:28 PDT 2013


On Tue, Sep 24, 2013 at 11:16:46AM +0900, Akira TAGOH wrote:
> Thanks for catching this up. that should be fixed in
> FcListPatternMatchAny so that it still likely happens after applying
> your patch if one gives the null FcPattern to FcFontList() or so in
> other applications. fixed in git this way.

That would be true if FcListPatternMatchAny wasn't an internal
function:

  $ git --no-pager grep FcListPatternMatchAny
  src/fccfg.c:    if (FcListPatternMatchAny (patterns->fonts[i], font))
  src/fcint.h:FcListPatternMatchAny (const FcPattern *p,
  src/fclist.c:FcListPatternMatchAny (const FcPattern *p,
  src/fclist.c:       if (FcListPatternMatchAny (p,               /* pattern */

I'm also not sure it makes sense to have different handling for NULL
FcPatterns and non-NULL FcPatterns with no elements, since the comment
for FcListPatternMatchAny says:

  FcTrue iff all objects in "p" match "font"

and neither of the above patterns have any objects.

It also seems like FcListPatternMatchAll would be a more intuitive
name ;).

With the more robust FcFontList, perhaps the !pat checks should be
removed from fc-match.c and fc-pattern.c?

In any case, the segfault is gone, which is what I really cared about.
If the internal logic makes sense to you, I'm happy enough ;).

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/fontconfig/attachments/20130923/f3c37794/attachment-0001.pgp>


More information about the Fontconfig mailing list