freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 966ff5a55 1/2: * src/cff/cffdrivr/c (cff_get_ps_name)


From: Werner Lemberg
Subject: [freetype2] master 966ff5a55 1/2: * src/cff/cffdrivr/c (cff_get_ps_name): Avoid unnecessary crash.
Date: Fri, 28 Apr 2023 09:37:31 -0400 (EDT)

branch: master
commit 966ff5a55cbe46e9ae4658e6e0e7ecb1e6e82b07
Author: Werner Lemberg <wl@gnu.org>
Commit: Werner Lemberg <wl@gnu.org>

    * src/cff/cffdrivr/c (cff_get_ps_name): Avoid unnecessary crash.
    
    The situation can happen if `FT_New_Face` (or one of its siblings) is called
    with a negative index to get the number of contained faces, followed
    immediately by a call to `FT_Get_Postscript_Name`.  While this is not a 
valid
    use of the FreeType library there is no need for a crash.
    
    Fixes #1219.
---
 src/cff/cffdrivr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index 81bff1fcc..7d45e4641 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -634,7 +634,7 @@
         return service->get_ps_font_name( FT_FACE( face ) );
     }
 
-    return (const char*)cff->font_name;
+    return cff ? (const char*)cff->font_name : NULL;
   }
 
 



reply via email to

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