[type1] Check relationship between number of axes and designs.

For Multiple Masters fonts We don't support intermediate designs;
this implies that

  number_of_designs == 2 ^^ number_of_axes

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9557

* src/type1/t1load.c (T1_Open_Face): Ensure above constraint.
(T1_Get_MM_Var): Remove now redundant test.
This commit is contained in:
Werner Lemberg 2018-07-24 23:03:06 +02:00
parent 71e29fe1c9
commit d8ea52dee5
2 changed files with 32 additions and 9 deletions

View File

@ -1,3 +1,19 @@
2018-07-24 Werner Lemberg <wl@gnu.org>
[type1] Check relationship between number of axes and designs.
For Multiple Masters fonts We don't support intermediate designs;
this implies that
number_of_designs == 2 ^^ number_of_axes
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9557
* src/type1/t1load.c (T1_Open_Face): Ensure above constraint.
(T1_Get_MM_Var): Remove now redundant test.
2018-07-24 Hin-Tak Leung <htl10@users.sourceforge.net> 2018-07-24 Hin-Tak Leung <htl10@users.sourceforge.net>
[truetype] Match ttdebug's naming of instruction mnemonics. [truetype] Match ttdebug's naming of instruction mnemonics.

View File

@ -348,8 +348,6 @@
mmvar->axis[i].tag = FT_MAKE_TAG( 'o', 'p', 's', 'z' ); mmvar->axis[i].tag = FT_MAKE_TAG( 'o', 'p', 's', 'z' );
} }
if ( blend->num_designs == ( 1U << blend->num_axis ) )
{
mm_weights_unmap( blend->default_weight_vector, mm_weights_unmap( blend->default_weight_vector,
axiscoords, axiscoords,
blend->num_axis ); blend->num_axis );
@ -357,7 +355,6 @@
for ( i = 0; i < mmaster.num_axis; i++ ) for ( i = 0; i < mmaster.num_axis; i++ )
mmvar->axis[i].def = mm_axis_unmap( &blend->design_map[i], mmvar->axis[i].def = mm_axis_unmap( &blend->design_map[i],
axiscoords[i] ); axiscoords[i] );
}
*master = mmvar; *master = mmvar;
@ -2356,6 +2353,16 @@
#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
/* we don't support Multiple Master fonts with intermediate designs; */
/* this implies that `num_designs' must be equal to `2^^num_axis' */
if ( face->blend &&
face->blend->num_designs != ( 1U << face->blend->num_axis ) )
{
FT_ERROR(( "T1_Open_Face:"
" number-of-designs != 2 ^^ number-of-axes\n" ));
T1_Done_Blend( face );
}
if ( face->blend && if ( face->blend &&
face->blend->num_default_design_vector != 0 && face->blend->num_default_design_vector != 0 &&
face->blend->num_default_design_vector != face->blend->num_axis ) face->blend->num_default_design_vector != face->blend->num_axis )