shithub: freetype+ttf2subf

Download patch

ref: 0b3cb8a8afb15247ee55477f73e25e0ca3038e5b
parent: 22167629d1361c763f2f9337515400d06f057aaa
author: Werner Lemberg <[email protected]>
date: Thu May 5 08:28:48 EDT 2016

[cff, truetype] Fix logic for `FT_Property_Set'.

Otherwise some properties could be set to arbitrary values, which is
harmless, but querying could give wrong positive results.

* src/cff/cffdrivr.c (cff_property_set) [hinting-engine],
* src/truetype/ttdriver.c (tt_property_set) [interpreter-version]:
Only allow defined values.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2016-05-05  Werner Lemberg  <[email protected]>
+
+	[cff, truetype] Fix logic for `FT_Property_Set'.
+
+	Otherwise some properties could be set to arbitrary values, which is
+	harmless, but querying could give wrong positive results.
+
+	* src/cff/cffdrivr.c (cff_property_set) [hinting-engine],
+	* src/truetype/ttdriver.c (tt_property_set) [interpreter-version]:
+	Only allow defined values.
+
 2016-04-25  Werner Lemberg  <[email protected]>
 
 	[autofit] Add blue-zone support for Gujarati script.
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -701,12 +701,14 @@
       FT_UInt*  hinting_engine = (FT_UInt*)value;
 
 
-#ifndef CFF_CONFIG_OPTION_OLD_ENGINE
-      if ( *hinting_engine != FT_CFF_HINTING_ADOBE )
-        error = FT_ERR( Unimplemented_Feature );
-      else
+      if ( *hinting_engine == FT_CFF_HINTING_ADOBE
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
+           || *hinting_engine == FT_CFF_HINTING_FREETYPE
 #endif
+         )
         driver->hinting_engine = *hinting_engine;
+      else
+        error = FT_ERR( Unimplemented_Feature );
 
       return error;
     }
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -72,12 +72,14 @@
       FT_UInt*  interpreter_version = (FT_UInt*)value;
 
 
-#ifndef TT_CONFIG_OPTION_SUBPIXEL_HINTING
-      if ( *interpreter_version != TT_INTERPRETER_VERSION_35 )
-        error = FT_ERR( Unimplemented_Feature );
-      else
+      if ( *interpreter_version == TT_INTERPRETER_VERSION_35
+#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
+           || *interpreter_version == TT_INTERPRETER_VERSION_38
 #endif
+         )
         driver->interpreter_version = *interpreter_version;
+      else
+        error = FT_ERR( Unimplemented_Feature );
 
       return error;
     }