freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 4a85ff0b7: [sfnt] Restrict POST version 1.0.


From: Werner Lemberg
Subject: [freetype2] master 4a85ff0b7: [sfnt] Restrict POST version 1.0.
Date: Thu, 4 Jan 2024 21:44:54 -0500 (EST)

branch: master
commit 4a85ff0b79ebb6a3e70c3b82cb63ffe4a0d4ccf0
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [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:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]