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

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

 



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

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
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