[sfnt] Restrict POST version 1.0.

A font has surfaced with `post` version 1.0 and fewer than 258 glyphs.
Its glyphs did not correspond to their names. We now reject such `post`
strictly following specifications.

* src/sfnt/ttpost.c (tt_face_get_ps_name): Check the number of glyphs
for version 1.0.
This commit is contained in:
Alexei Podtelezhnikov 2024-01-04 21:38:51 -05:00
parent a07ca46cd0
commit 4a85ff0b79

View File

@ -436,13 +436,8 @@
format = face->postscript.FormatType;
if ( format == 0x00010000L )
{
if ( idx < 258 ) /* paranoid checking */
*PSname = MAC_NAME( idx );
}
else if ( format == 0x00020000L ||
format == 0x00025000L )
if ( format == 0x00020000L ||
format == 0x00025000L )
{
TT_Post_Names names = &face->postscript_names;
@ -466,6 +461,11 @@
}
}
/* version 1.0 is only valid with 258 glyphs */
else if ( format == 0x00010000L &&
face->max_profile.numGlyphs == 258 )
*PSname = MAC_NAME( idx );
/* nothing to do for format == 0x00030000L */
End: