Commit 4f11209f5cd4f83f185042d54ad1c892dffb5ed1

Alexei Podtelezhnikov 2018-06-28T21:31:35

* src/base/ftobjs.c (FT_Set_Charmap): Robustify.

diff --git a/ChangeLog b/ChangeLog
index 11de7b9..2dc6d29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-06-28  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	* src/base/ftobjs.c (FT_Set_Charmap): Robustify.
+
 2018-06-25  Werner Lemberg  <wl@gnu.org>
 
 	[truetype] Fix memory leak.
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 38214b5..baaeaff 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -3526,14 +3526,12 @@
     if ( !cur || !charmap )
       return FT_THROW( Invalid_CharMap_Handle );
 
-    if ( FT_Get_CMap_Format( charmap ) == 14 )
-      return FT_THROW( Invalid_Argument );
-
     limit = cur + face->num_charmaps;
 
     for ( ; cur < limit; cur++ )
     {
-      if ( cur[0] == charmap )
+      if ( cur[0] == charmap                    &&
+           FT_Get_CMap_Format ( charmap ) != 14 )
       {
         face->charmap = cur[0];
         return FT_Err_Ok;