summaryrefslogtreecommitdiff
path: root/Build/source/libs/freetype2/freetype-src/src/type42
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/freetype2/freetype-src/src/type42')
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.c15
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/t42error.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/t42objs.c17
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/t42objs.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/t42parse.c69
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/t42parse.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/t42types.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/type42.c2
11 files changed, 63 insertions, 54 deletions
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/module.mk b/Build/source/libs/freetype2/freetype-src/src/type42/module.mk
index ec3214cda61..f619fa5c732 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2002-2021 by
+# Copyright (C) 2002-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/rules.mk b/Build/source/libs/freetype2/freetype-src/src/type42/rules.mk
index 9821943eaf5..9d26c879d92 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2002-2021 by
+# Copyright (C) 2002-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.c b/Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.c
index e74ba1deba7..45d8c3821b7 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.c
@@ -4,7 +4,7 @@
*
* High-level Type 42 driver interface (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2022 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
@@ -150,22 +150,13 @@
}
- static FT_Error
- t42_ps_get_font_private( FT_Face face,
- PS_PrivateRec* afont_private )
- {
- *afont_private = ((T42_Face)face)->type1.private_dict;
-
- return FT_Err_Ok;
- }
-
-
static const FT_Service_PsInfoRec t42_service_ps_info =
{
(PS_GetFontInfoFunc) t42_ps_get_font_info, /* ps_get_font_info */
(PS_GetFontExtraFunc) t42_ps_get_font_extra, /* ps_get_font_extra */
(PS_HasGlyphNamesFunc) t42_ps_has_glyph_names, /* ps_has_glyph_names */
- (PS_GetFontPrivateFunc)t42_ps_get_font_private, /* ps_get_font_private */
+ /* Type42 fonts don't have a Private dict */
+ (PS_GetFontPrivateFunc)NULL, /* ps_get_font_private */
/* not implemented */
(PS_GetFontValueFunc) NULL /* ps_get_font_value */
};
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.h b/Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.h
index c6d8a4409e1..95e1207b680 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.h
@@ -4,7 +4,7 @@
*
* High-level Type 42 driver interface (specification).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2022 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/t42error.h b/Build/source/libs/freetype2/freetype-src/src/type42/t42error.h
index 470f5189a87..b2782210065 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/t42error.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/t42error.h
@@ -4,7 +4,7 @@
*
* Type 42 error codes (specification only).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/t42objs.c b/Build/source/libs/freetype2/freetype-src/src/type42/t42objs.c
index 03955e945ba..da1e0732a00 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/t42objs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/t42objs.c
@@ -4,7 +4,7 @@
*
* Type 42 objects manager (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2022 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
@@ -44,14 +44,8 @@
parser = &loader.parser;
- if ( FT_QALLOC( face->ttf_data, 12 ) )
- goto Exit;
-
- /* while parsing the font we always update `face->ttf_size' so that */
- /* even in case of buggy data (which might lead to premature end of */
- /* scanning without causing an error) the call to `FT_Open_Face' in */
- /* `T42_Face_Init' passes the correct size */
- face->ttf_size = 12;
+ face->ttf_data = NULL;
+ face->ttf_size = 0;
error = t42_parser_init( parser,
face->root.stream,
@@ -152,6 +146,11 @@
Exit:
t42_loader_done( &loader );
+ if ( error )
+ {
+ FT_FREE( face->ttf_data );
+ face->ttf_size = 0;
+ }
return error;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/t42objs.h b/Build/source/libs/freetype2/freetype-src/src/type42/t42objs.h
index cbd344ffbd4..e677996a307 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/t42objs.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/t42objs.h
@@ -4,7 +4,7 @@
*
* Type 42 objects manager (specification).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2022 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/t42parse.c b/Build/source/libs/freetype2/freetype-src/src/type42/t42parse.c
index ea2c5198a9d..59cc519ea6d 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/t42parse.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/t42parse.c
@@ -4,7 +4,7 @@
*
* Type 42 font parser (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2022 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
@@ -92,7 +92,7 @@
#undef T1CODE
#define T1CODE T1_FIELD_LOCATION_BBOX
- T1_FIELD_BBOX("FontBBox", xMin, 0 )
+ T1_FIELD_BBOX( "FontBBox", xMin, 0 )
T1_FIELD_CALLBACK( "FontMatrix", t42_parse_font_matrix, 0 )
T1_FIELD_CALLBACK( "Encoding", t42_parse_encoding, 0 )
@@ -363,8 +363,8 @@
/* we use a T1_Table to store our charnames */
loader->num_chars = encode->num_chars = count;
- if ( FT_NEW_ARRAY( encode->char_index, count ) ||
- FT_NEW_ARRAY( encode->char_name, count ) ||
+ if ( FT_QNEW_ARRAY( encode->char_index, count ) ||
+ FT_QNEW_ARRAY( encode->char_name, count ) ||
FT_SET_ERROR( psaux->ps_table_funcs->init(
char_table, count, memory ) ) )
{
@@ -538,7 +538,8 @@
FT_Byte* limit = parser->root.limit;
FT_Error error;
FT_Int num_tables = 0;
- FT_Long count;
+ FT_Long ttf_count;
+ FT_Long ttf_reserved;
FT_ULong n, string_size, old_string_size, real_size;
FT_Byte* string_buf = NULL;
@@ -546,6 +547,9 @@
T42_Load_Status status;
+ /** There should only be one sfnts array, but free any previous. */
+ FT_FREE( face->ttf_data );
+ face->ttf_size = 0;
/* The format is */
/* */
@@ -574,7 +578,10 @@
status = BEFORE_START;
string_size = 0;
old_string_size = 0;
- count = 0;
+ ttf_count = 0;
+ ttf_reserved = 12;
+ if ( FT_QALLOC( face->ttf_data, ttf_reserved ) )
+ goto Fail;
FT_TRACE2(( "\n" ));
FT_TRACE2(( "t42_parse_sfnts:\n" ));
@@ -589,6 +596,7 @@
if ( *cur == ']' )
{
parser->root.cursor++;
+ face->ttf_size = ttf_count;
goto Exit;
}
@@ -684,7 +692,7 @@
}
FT_TRACE2(( " PS string size %5lu bytes, offset 0x%08lx (%lu)\n",
- string_size, count, count ));
+ string_size, ttf_count, ttf_count ));
/* The whole TTF is now loaded into `string_buf'. We are */
/* checking its contents while copying it to `ttf_data'. */
@@ -697,43 +705,48 @@
{
case BEFORE_START:
/* load offset table, 12 bytes */
- if ( count < 12 )
+ if ( ttf_count < 12 )
{
- face->ttf_data[count++] = string_buf[n];
+ face->ttf_data[ttf_count++] = string_buf[n];
continue;
}
else
{
- num_tables = 16 * face->ttf_data[4] + face->ttf_data[5];
- status = BEFORE_TABLE_DIR;
- face->ttf_size = 12 + 16 * num_tables;
+ FT_Long ttf_reserved_prev = ttf_reserved;
+
+
+ num_tables = 16 * face->ttf_data[4] + face->ttf_data[5];
+ status = BEFORE_TABLE_DIR;
+ ttf_reserved = 12 + 16 * num_tables;
FT_TRACE2(( " SFNT directory contains %d tables\n",
num_tables ));
- if ( (FT_Long)size < face->ttf_size )
+ if ( (FT_Long)size < ttf_reserved )
{
FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" ));
error = FT_THROW( Invalid_File_Format );
goto Fail;
}
- if ( FT_QREALLOC( face->ttf_data, 12, face->ttf_size ) )
+ if ( FT_QREALLOC( face->ttf_data, ttf_reserved_prev,
+ ttf_reserved ) )
goto Fail;
}
/* fall through */
case BEFORE_TABLE_DIR:
/* the offset table is read; read the table directory */
- if ( count < face->ttf_size )
+ if ( ttf_count < ttf_reserved )
{
- face->ttf_data[count++] = string_buf[n];
+ face->ttf_data[ttf_count++] = string_buf[n];
continue;
}
else
{
int i;
FT_ULong len;
+ FT_Long ttf_reserved_prev = ttf_reserved;
FT_TRACE2(( "\n" ));
@@ -749,7 +762,7 @@
FT_TRACE2(( " %4i 0x%08lx (%lu)\n", i, len, len ));
if ( len > size ||
- face->ttf_size > (FT_Long)( size - len ) )
+ ttf_reserved > (FT_Long)( size - len ) )
{
FT_ERROR(( "t42_parse_sfnts:"
" invalid data in sfnts array\n" ));
@@ -758,30 +771,31 @@
}
/* Pad to a 4-byte boundary length */
- face->ttf_size += (FT_Long)( ( len + 3 ) & ~3U );
+ ttf_reserved += (FT_Long)( ( len + 3 ) & ~3U );
}
+ ttf_reserved += 1;
status = OTHER_TABLES;
FT_TRACE2(( "\n" ));
- FT_TRACE2(( " allocating %ld bytes\n", face->ttf_size + 1 ));
+ FT_TRACE2(( " allocating %ld bytes\n", ttf_reserved ));
FT_TRACE2(( "\n" ));
- if ( FT_QREALLOC( face->ttf_data, 12 + 16 * num_tables,
- face->ttf_size + 1 ) )
+ if ( FT_QREALLOC( face->ttf_data, ttf_reserved_prev,
+ ttf_reserved ) )
goto Fail;
}
/* fall through */
case OTHER_TABLES:
/* all other tables are just copied */
- if ( count >= face->ttf_size )
+ if ( ttf_count >= ttf_reserved )
{
FT_ERROR(( "t42_parse_sfnts: too much binary data\n" ));
error = FT_THROW( Invalid_File_Format );
goto Fail;
}
- face->ttf_data[count++] = string_buf[n];
+ face->ttf_data[ttf_count++] = string_buf[n];
}
}
@@ -795,6 +809,11 @@
parser->root.error = error;
Exit:
+ if ( parser->root.error )
+ {
+ FT_FREE( face->ttf_data );
+ face->ttf_size = 0;
+ }
if ( allocated )
FT_FREE( string_buf );
}
@@ -989,9 +1008,9 @@
name_table->elements[n][len] = '\0';
/* record index of /.notdef */
- if ( *cur == '.' &&
+ if ( *cur == '.' &&
ft_strcmp( ".notdef",
- (const char*)(name_table->elements[n]) ) == 0 )
+ (const char*)( name_table->elements[n] ) ) == 0 )
{
notdef_index = n;
notdef_found = 1;
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/t42parse.h b/Build/source/libs/freetype2/freetype-src/src/type42/t42parse.h
index 0fbd2b5e0bc..fa633e7f1e8 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/t42parse.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/t42parse.h
@@ -4,7 +4,7 @@
*
* Type 42 font parser (specification).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2022 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/t42types.h b/Build/source/libs/freetype2/freetype-src/src/type42/t42types.h
index ea2f03e8930..985bdfda98e 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/t42types.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/t42types.h
@@ -4,7 +4,7 @@
*
* Type 42 font data types (specification only).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2022 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/type42.c b/Build/source/libs/freetype2/freetype-src/src/type42/type42.c
index d8d3936bdf5..ccf5d472b85 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/type42.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/type42.c
@@ -4,7 +4,7 @@
*
* FreeType Type 42 driver component.
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,