Subject: | GPOS parsing runs out of memory |
My application needs to read the GPOS table when building a map from
fonts found in the Windows Fonts directory. Windows 7 comes stock
with a font named 'Mangal'. This font (and only this one) triggers an
out of memory condition.
use Font::TTF::Font;
my $fontfile = $ARGV[0] || "c:/windows/fonts/Mangal.ttf";
my $f = Font::TTF::Font->open($fontfile) || die "error opening TrueType font '$fontfile'.\n";
$f->{GPOS}->read if(exists $f->{GPOS});
I can't suggest a fix, but I narrowed the problem down to read_delta() in GPOS.pm. When I comment out this part of read_value():
foreach $s (qw(XPlaDevice YPlaDevice XAdvDevice YAdvDevice))
{
if ($fmt & $flag)
{ $res->{$s} = $self->read_delta(TTF_Unpack('S', substr($dat, $i++ << 1, 2)),
$base, $lookup, $fh); }
$flag <<= 1;
}
perl (v5.22.1 MSWin32-x64-multi-thread) finishes OK.
No font in a stock Windows 10 triggers the problem, but then, Mangal
doesn't seem to be included any more.
I didn't assign a severity but then, it's a show stopper nevertheless.