diff options
author | Werner Lemberg <wl@gnu.org> | 2019-10-08 11:12:18 +0200 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2019-10-08 11:12:18 +0200 |
commit | 5a1a79c0e8de8e886cc347ad22801982e8298a06 (patch) | |
tree | d25d9d5e8576854e288e1b5d3ac25b7ec9b0dfe3 /include | |
parent | 1167bff3e9a6302687667c6134673e4b3fd13636 (diff) | |
download | freetype2-5a1a79c0e8de8e886cc347ad22801982e8298a06.tar.gz |
[woff2] Fix SFNT table checks.
Also reduce number of SFNT table lookups.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18065
* include/freetype/internal/wofftypes.h (WOFF2_InfoRec): Add fields
`glyf_table', `loca_table', and `head_table'.
* src/sfnt/sfwoff2.c (reconstruct_glyf): Update signature.
Use table pointers in `info' parameter.
(get_x_mins): Check `maxp_table'
Use table pointers in `info' parameter.
(reconstruct_font): Use and set table pointers in `info' parameter.
Fix check for `glyf' and `loca' tables.
Update call to `reconstruct_glyf'.
(woff2_open_font): Updated.
Diffstat (limited to 'include')
-rw-r--r-- | include/freetype/internal/wofftypes.h | 69 |
1 files changed, 41 insertions, 28 deletions
diff --git a/include/freetype/internal/wofftypes.h b/include/freetype/internal/wofftypes.h index 5741fbabb..7b1689d81 100644 --- a/include/freetype/internal/wofftypes.h +++ b/include/freetype/internal/wofftypes.h @@ -179,6 +179,34 @@ FT_BEGIN_HEADER /************************************************************************** * * @struct: + * WOFF2_TableRec + * + * @description: + * This structure describes a given table of a WOFF2 font. + * + * @fields: + * See + * + * https://www.w3.org/TR/WOFF2/#table_dir_format + */ + typedef struct WOFF2_TableRec_ + { + FT_Byte FlagByte; /* table type and flags */ + FT_ULong Tag; /* table file offset */ + FT_ULong dst_length; /* uncompressed table length */ + FT_ULong TransformLength; /* transformed length */ + + FT_ULong flags; /* calculated flags */ + FT_ULong src_offset; /* compressed table offset */ + FT_ULong src_length; /* compressed table length */ + FT_ULong dst_offset; /* uncompressed table offset */ + + } WOFF2_TableRec, *WOFF2_Table; + + + /************************************************************************** + * + * @struct: * WOFF2_InfoRec * * @description: @@ -197,6 +225,15 @@ FT_BEGIN_HEADER * * x_mins :: * `xMin` values of glyph bounding box. + * + * glyf_table :: + * A pointer to the `glyf' table record. + * + * loca_table :: + * A pointer to the `loca' table record. + * + * head_table :: + * A pointer to the `head' table record. */ typedef struct WOFF2_InfoRec_ { @@ -205,35 +242,11 @@ FT_BEGIN_HEADER FT_UShort num_hmetrics; FT_Short* x_mins; - } WOFF2_InfoRec, *WOFF2_Info; - - - /************************************************************************** - * - * @struct: - * WOFF2_TableRec - * - * @description: - * This structure describes a given table of a WOFF2 font. - * - * @fields: - * See - * - * https://www.w3.org/TR/WOFF2/#table_dir_format - */ - typedef struct WOFF2_TableRec_ - { - FT_Byte FlagByte; /* table type and flags */ - FT_ULong Tag; /* table file offset */ - FT_ULong dst_length; /* uncompressed table length */ - FT_ULong TransformLength; /* transformed length */ - - FT_ULong flags; /* calculated flags */ - FT_ULong src_offset; /* compressed table offset */ - FT_ULong src_length; /* compressed table length */ - FT_ULong dst_offset; /* uncompressed table offset */ + WOFF2_Table glyf_table; + WOFF2_Table loca_table; + WOFF2_Table head_table; - } WOFF2_TableRec, *WOFF2_Table; + } WOFF2_InfoRec, *WOFF2_Info; /************************************************************************** |