From 6862024854c64d7f7bbb80d4909c19a45c4f7d9a Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 16 Dec 2016 11:15:17 +0100 Subject: [PATCH] [cff, truetype] Remove compiler warnings; fix `make multi'. * src/cff/cf2font.h: Include `cffload.h'. * src/cff/cffload.c: Include FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H. (cff_vstore_load): Eliminate `vsSize'. (cff_load_private_dict): Tag as `FT_LOCAL_DEF'. * src/cff/cffload.h: Include `cffobjs.h'. Provide declaration for `cff_load_private_dict'. * src/truetype/ttgxvar.c (ft_var_load_hvar): Eliminate `minorVersion' and `map_offset'. --- ChangeLog | 17 +++++++++++++++++ src/cff/cf2font.h | 1 + src/cff/cffload.c | 13 +++++++++---- src/cff/cffload.h | 7 +++++++ src/truetype/ttgxvar.c | 8 ++++---- 5 files changed, 38 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1243bd4bb..8fed6a2a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2016-12-16 Werner Lemberg + + [cff, truetype] Remove compiler warnings; fix `make multi'. + + * src/cff/cf2font.h: Include `cffload.h'. + + * src/cff/cffload.c: Include FT_MULTIPLE_MASTERS_H and + FT_SERVICE_MULTIPLE_MASTERS_H. + (cff_vstore_load): Eliminate `vsSize'. + (cff_load_private_dict): Tag as `FT_LOCAL_DEF'. + + * src/cff/cffload.h: Include `cffobjs.h'. + Provide declaration for `cff_load_private_dict'. + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Eliminate + `minorVersion' and `map_offset'. + 2016-12-16 Werner Lemberg [cff] Fix heap buffer overflow (#49858). diff --git a/src/cff/cf2font.h b/src/cff/cf2font.h index 1b6241774..17ecd17bb 100644 --- a/src/cff/cf2font.h +++ b/src/cff/cf2font.h @@ -42,6 +42,7 @@ #include "cf2ft.h" #include "cf2blues.h" +#include "cffload.h" FT_BEGIN_HEADER diff --git a/src/cff/cffload.c b/src/cff/cffload.c index e930bbc79..b9e052d9d 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -23,6 +23,11 @@ #include FT_TRUETYPE_TAGS_H #include FT_TYPE1_TABLES_H +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include FT_MULTIPLE_MASTERS_H +#include FT_SERVICE_MULTIPLE_MASTERS_H +#endif + #include "cffload.h" #include "cffparse.h" @@ -1126,15 +1131,15 @@ /* no offset means no vstore to parse */ if ( offset ) { - FT_UInt vsSize; /* currently unused */ FT_UInt vsOffset; FT_UInt format; FT_ULong regionListOffset; - /* we need to parse the table to determine its size */ + /* we need to parse the table to determine its size; */ + /* skip table length */ if ( FT_STREAM_SEEK( base_offset + offset ) || - FT_READ_USHORT( vsSize ) ) + FT_STREAM_SKIP( 2 ) ) goto Exit; /* actual variation store begins after the length */ @@ -1824,7 +1829,7 @@ /* so NDV has not been set for CFF2 variation. */ /* */ /* `cff_slot_load' must call this function each time NDV changes. */ - static FT_Error + FT_LOCAL_DEF( FT_Error ) cff_load_private_dict( CFF_Font font, CFF_SubFont subfont, FT_UInt lenNDV, diff --git a/src/cff/cffload.h b/src/cff/cffload.h index 9924a8a1d..2da726ca5 100644 --- a/src/cff/cffload.h +++ b/src/cff/cffload.h @@ -23,6 +23,7 @@ #include #include "cfftypes.h" #include "cffparse.h" +#include "cffobjs.h" /* for CFF_Face */ FT_BEGIN_HEADER @@ -72,6 +73,12 @@ FT_BEGIN_HEADER cff_font_done( CFF_Font font ); + FT_LOCAL( FT_Error ) + cff_load_private_dict( CFF_Font font, + CFF_SubFont subfont, + FT_UInt lenNDV, + FT_Fixed* NDV ); + FT_LOCAL( FT_Byte ) cff_fd_select_get( CFF_FDSelect fdselect, FT_UInt glyph_index ); diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 8df6b1164..dae0cb7ed 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -433,11 +433,9 @@ FT_Error error; FT_UShort majorVersion; - FT_UShort minorVersion; FT_ULong table_len; FT_ULong table_offset; FT_ULong store_offset; - FT_ULong map_offset; FT_ULong* dataOffsetArray = NULL; @@ -455,8 +453,9 @@ table_offset = FT_STREAM_POS(); + /* skip minor version */ if ( FT_READ_USHORT( majorVersion ) || - FT_READ_USHORT( minorVersion ) ) + FT_STREAM_SKIP( 2 ) ) goto Exit; if ( majorVersion != 1 ) { @@ -465,8 +464,9 @@ goto Exit; } + /* skip map offset */ if ( FT_READ_ULONG( store_offset ) || - FT_READ_ULONG( map_offset ) ) + FT_STREAM_SKIP( 4 ) ) goto Exit; /* parse item variation store */