[truetype] Limit delta shift range.

The legal range for delta shift is zero through six. Negative values
are illegal according to
  https://developer.apple.com/fonts/TrueType-Reference-Manual/RM04/Chap4.html#delta%20shift

* src/truetype/ttobjs.h (delta_shift, delta_base): Make unsigned.
* src/truetype/ttinterp.h (DO_SDS): Throw an error if delta_shift
  out of range.
  (Ins_DELTAP, Ins_DELTAC): Optimize for legal delta_shift.
This commit is contained in:
Alexei Podtelezhnikov 2014-10-14 23:03:56 -04:00
parent 3889cb2faa
commit 7e83f06804
3 changed files with 24 additions and 8 deletions

View File

@ -1,3 +1,16 @@
2014-10-14 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Limit delta shift range.
The legal range for delta shift is zero through six. Negative values
are illegal according to
https://developer.apple.com/fonts/TrueType-Reference-Manual/RM04/Chap4.html#delta%20shift
* src/truetype/ttobjs.h (delta_shift, delta_base): Make unsigned.
* src/truetype/ttinterp.h (DO_SDS): Throw an error if delta_shift
out of range.
(Ins_DELTAP, Ins_DELTAC): Optimize for legal delta_shift.
2014-10-14 David Weiß <David.Weiss@ptvgroup.com>
[build] Better optimization settings for vc2010 solution file.

View File

@ -3081,12 +3081,15 @@
CUR.GS.auto_flip = FALSE;
#define DO_SDB \
CUR.GS.delta_base = (FT_Short)args[0];
#define DO_SDB \
CUR.GS.delta_base = (FT_UShort)args[0];
#define DO_SDS \
CUR.GS.delta_shift = (FT_Short)args[0];
#define DO_SDS \
if ( (FT_ULong)args[0] > 6UL ) \
CUR.error = FT_THROW( Bad_Argument ); \
else \
CUR.GS.delta_shift = (FT_UShort)args[0];
#define DO_MD /* nothing */
@ -7577,7 +7580,7 @@
B = ( (FT_ULong)B & 0xF ) - 8;
if ( B >= 0 )
B++;
B = B * 64 / ( 1L << CUR.GS.delta_shift );
B *= 1L << ( 6 - CUR.GS.delta_shift );
#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
@ -7747,7 +7750,7 @@
B = ( (FT_ULong)B & 0xF ) - 8;
if ( B >= 0 )
B++;
B = B * 64 / ( 1L << CUR.GS.delta_shift );
B *= 1L << ( 6 - CUR.GS.delta_shift );
CUR_Func_move_cvt( A, B );
}

View File

@ -95,8 +95,8 @@ FT_BEGIN_HEADER
FT_F26Dot6 control_value_cutin;
FT_F26Dot6 single_width_cutin;
FT_F26Dot6 single_width_value;
FT_Short delta_base;
FT_Short delta_shift;
FT_UShort delta_base;
FT_UShort delta_shift;
FT_Byte instruct_control;
/* According to Greg Hitchcock from Microsoft, the `scan_control' */