From 4a85ff0b79ebb6a3e70c3b82cb63ffe4a0d4ccf0 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 4 Jan 2024 21:38:51 -0500 Subject: [PATCH] [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. --- src/sfnt/ttpost.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index f2aeae233..dcde7def8 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -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: