[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
diff --git a/ChangeLog b/ChangeLog
index c329253..c5f7da7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2016-05-05 Werner Lemberg <wl@gnu.org>
+
+ [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 <wl@gnu.org>
[autofit] Add blue-zone support for Gujarati script.
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index 7a82094..950a960 100644
--- 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;
}
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index bbebabd..abbd127 100644
--- 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;
}