Bug 71085 - "out of memory" errors on empty match element in fonts.conf
Summary: "out of memory" errors on empty match element in fonts.conf
Status: RESOLVED FIXED
Alias: None
Product: fontconfig
Classification: Unclassified
Component: library (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: fontconfig-bugs
QA Contact: Behdad Esfahbod
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-31 11:06 UTC by Vincent Lefevre
Modified: 2013-10-31 13:14 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Vincent Lefevre 2013-10-31 11:06:17 UTC
Under Debian/unstable, after upgrading fontconfig from 2.10.2 to 2.11, I get "out of memory" errors with the following fonts.conf file:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font">
  <!-- Commented out code. -->
</match>
</fontconfig>

According to the DTD, it is valid.

$ gnuplot -persist <<EOF
plot '-' using 1:2 t '' with line
0 0
10 10
e
EOF
Fontconfig error: "/home/vinc17/.config/fontconfig/fonts.conf", line 6: out of memory

Ditto when running other programs using the fontconfig library.
Comment 1 Vincent Lefevre 2013-10-31 11:13:38 UTC
Note: This error can also occur with other conf files, but this time invalid. See

  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=726985

for instance. You may want to fix both problems at the same time (for an invalid file, an error is OK, but not "out of memory").
Comment 2 Akira TAGOH 2013-10-31 12:32:55 UTC
(In reply to comment #0)
> Under Debian/unstable, after upgrading fontconfig from 2.10.2 to 2.11, I get
> "out of memory" errors with the following fonts.conf file:
> 
> <?xml version="1.0"?>
> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
> <fontconfig>
> <match target="font">
>   <!-- Commented out code. -->
> </match>
> </fontconfig>
> 
> According to the DTD, it is valid.

that is invalid case. DTD says:

<!ELEMENT match (test*, edit*)+>

match element has to contain one test or edit at least.
Comment 3 Vincent Lefevre 2013-10-31 12:51:11 UTC
(In reply to comment #2)
> that is invalid case. DTD says:
> 
> <!ELEMENT match (test*, edit*)+>
> 
> match element has to contain one test or edit at least.

I don't think so, because you have * after "test" and after "edit". At least, "xmllint --noout --loaddtd --valid" validates the XML file. This is different from:

<!ELEMENT match (test | edit)+>
Comment 4 Akira TAGOH 2013-10-31 13:11:32 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > that is invalid case. DTD says:
> > 
> > <!ELEMENT match (test*, edit*)+>
> > 
> > match element has to contain one test or edit at least.
> 
> I don't think so, because you have * after "test" and after "edit". At
> least, "xmllint --noout --loaddtd --valid" validates the XML file. This is
> different from:
> 
> <!ELEMENT match (test | edit)+>

I misunderstood that then. let me correct for that too.
Comment 5 Akira TAGOH 2013-10-31 13:14:18 UTC
Fixed in git. thanks!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.