From 0b3cb8a8afb15247ee55477f73e25e0ca3038e5b Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 5 May 2016 12:28:48 +0200 Subject: [PATCH] [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. --- ChangeLog | 11 +++++++++++ src/cff/cffdrivr.c | 10 ++++++---- src/truetype/ttdriver.c | 10 ++++++---- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index c32925344..c5f7da704 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2016-05-05 Werner Lemberg + + [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 [autofit] Add blue-zone support for Gujarati script. diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 7a820940d..950a9605c 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 bbebabdad..abbd1277b 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; }