Werner Lemberg pushed to branch master at FreeType / FreeType
Commits:
-
d31bafcb
by Werner Lemberg at 2021-11-14T11:02:54+01:00
5 changed files:
- src/gxvalid/gxvcommn.h
- src/gxvalid/gxvmod.c
- src/smooth/ftgrays.c
- src/type1/t1gload.c
- src/type1/t1load.c
Changes:
... | ... | @@ -61,8 +61,11 @@ FT_BEGIN_HEADER |
61 | 61 |
|
62 | 62 |
#undef GXV_LOAD_UNUSED_VARS /* debug purpose */
|
63 | 63 |
|
64 |
-#define IS_PARANOID_VALIDATION ( gxvalid->root->level >= FT_VALIDATE_PARANOID )
|
|
65 |
-#define GXV_SET_ERR_IF_PARANOID( err ) { if ( IS_PARANOID_VALIDATION ) ( err ); }
|
|
64 |
+#define IS_PARANOID_VALIDATION \
|
|
65 |
+ ( gxvalid->root->level >= FT_VALIDATE_PARANOID )
|
|
66 |
+#define GXV_SET_ERR_IF_PARANOID( err ) \
|
|
67 |
+ do { if ( IS_PARANOID_VALIDATION ) ( err ); } while ( 0 )
|
|
68 |
+ |
|
66 | 69 |
|
67 | 70 |
/*************************************************************************/
|
68 | 71 |
/*************************************************************************/
|
... | ... | @@ -76,27 +76,33 @@ |
76 | 76 |
FT_Byte* volatile _sfnt = NULL; \
|
77 | 77 |
FT_ULong len_ ## _sfnt = 0
|
78 | 78 |
|
79 |
-#define GXV_TABLE_LOAD( _sfnt ) \
|
|
80 |
- if ( ( FT_VALIDATE_ ## _sfnt ## _INDEX < table_count ) && \
|
|
81 |
- ( gx_flags & FT_VALIDATE_ ## _sfnt ) ) \
|
|
82 |
- { \
|
|
83 |
- error = gxv_load_table( face, TTAG_ ## _sfnt, \
|
|
84 |
- &_sfnt, &len_ ## _sfnt ); \
|
|
85 |
- if ( error ) \
|
|
86 |
- goto Exit; \
|
|
87 |
- }
|
|
88 |
- |
|
89 |
-#define GXV_TABLE_VALIDATE( _sfnt ) \
|
|
90 |
- if ( _sfnt ) \
|
|
91 |
- { \
|
|
92 |
- ft_validator_init( &valid, _sfnt, _sfnt + len_ ## _sfnt, \
|
|
93 |
- FT_VALIDATE_DEFAULT ); \
|
|
94 |
- if ( ft_setjmp( valid.jump_buffer ) == 0 ) \
|
|
95 |
- gxv_ ## _sfnt ## _validate( _sfnt, face, &valid ); \
|
|
96 |
- error = valid.error; \
|
|
97 |
- if ( error ) \
|
|
98 |
- goto Exit; \
|
|
99 |
- }
|
|
79 |
+#define GXV_TABLE_LOAD( _sfnt ) \
|
|
80 |
+ do \
|
|
81 |
+ { \
|
|
82 |
+ if ( ( FT_VALIDATE_ ## _sfnt ## _INDEX < table_count ) && \
|
|
83 |
+ ( gx_flags & FT_VALIDATE_ ## _sfnt ) ) \
|
|
84 |
+ { \
|
|
85 |
+ error = gxv_load_table( face, TTAG_ ## _sfnt, \
|
|
86 |
+ &_sfnt, &len_ ## _sfnt ); \
|
|
87 |
+ if ( error ) \
|
|
88 |
+ goto Exit; \
|
|
89 |
+ } \
|
|
90 |
+ } while ( 0 )
|
|
91 |
+ |
|
92 |
+#define GXV_TABLE_VALIDATE( _sfnt ) \
|
|
93 |
+ do \
|
|
94 |
+ { \
|
|
95 |
+ if ( _sfnt ) \
|
|
96 |
+ { \
|
|
97 |
+ ft_validator_init( &valid, _sfnt, _sfnt + len_ ## _sfnt, \
|
|
98 |
+ FT_VALIDATE_DEFAULT ); \
|
|
99 |
+ if ( ft_setjmp( valid.jump_buffer ) == 0 ) \
|
|
100 |
+ gxv_ ## _sfnt ## _validate( _sfnt, face, &valid ); \
|
|
101 |
+ error = valid.error; \
|
|
102 |
+ if ( error ) \
|
|
103 |
+ goto Exit; \
|
|
104 |
+ } \
|
|
105 |
+ } while ( 0 )
|
|
100 | 106 |
|
101 | 107 |
#define GXV_TABLE_SET( _sfnt ) \
|
102 | 108 |
if ( FT_VALIDATE_ ## _sfnt ## _INDEX < table_count ) \
|
... | ... | @@ -1986,8 +1986,8 @@ typedef ptrdiff_t FT_PtrDist; |
1986 | 1986 |
ras.ycells[w] = ras.cell_null;
|
1987 | 1987 |
|
1988 | 1988 |
/* memory management: skip ycells */
|
1989 |
- n = ( width * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) /
|
|
1990 |
- sizeof ( TCell );
|
|
1989 |
+ n = ( (size_t)width * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) /
|
|
1990 |
+ sizeof ( TCell );
|
|
1991 | 1991 |
|
1992 | 1992 |
ras.cell_free = buffer + n;
|
1993 | 1993 |
ras.cell = ras.cell_null;
|
... | ... | @@ -79,7 +79,7 @@ |
79 | 79 |
/* For ordinary fonts get the character data stored in the face record. */
|
80 | 80 |
{
|
81 | 81 |
char_string->pointer = type1->charstrings[glyph_index];
|
82 |
- char_string->length = (FT_Int)type1->charstrings_len[glyph_index];
|
|
82 |
+ char_string->length = type1->charstrings_len[glyph_index];
|
|
83 | 83 |
}
|
84 | 84 |
|
85 | 85 |
if ( !error )
|
... | ... | @@ -1346,7 +1346,7 @@ |
1346 | 1346 |
|
1347 | 1347 |
static int
|
1348 | 1348 |
read_binary_data( T1_Parser parser,
|
1349 |
- FT_Long* size,
|
|
1349 |
+ FT_ULong* size,
|
|
1350 | 1350 |
FT_Byte** base,
|
1351 | 1351 |
FT_Bool incremental )
|
1352 | 1352 |
{
|
... | ... | @@ -1378,7 +1378,7 @@ |
1378 | 1378 |
if ( s >= 0 && s < limit - *base )
|
1379 | 1379 |
{
|
1380 | 1380 |
parser->root.cursor += s + 1;
|
1381 |
- *size = s;
|
|
1381 |
+ *size = (FT_ULong)s;
|
|
1382 | 1382 |
return !parser->root.error;
|
1383 | 1383 |
}
|
1384 | 1384 |
}
|
... | ... | @@ -1803,7 +1803,7 @@ |
1803 | 1803 |
for ( count = 0; ; count++ )
|
1804 | 1804 |
{
|
1805 | 1805 |
FT_Long idx;
|
1806 |
- FT_Long size;
|
|
1806 |
+ FT_ULong size;
|
|
1807 | 1807 |
FT_Byte* base;
|
1808 | 1808 |
|
1809 | 1809 |
|
... | ... | @@ -1861,7 +1861,7 @@ |
1861 | 1861 |
/* some fonts define empty subr records -- this is not totally */
|
1862 | 1862 |
/* compliant to the specification (which says they should at */
|
1863 | 1863 |
/* least contain a `return'), but we support them anyway */
|
1864 |
- if ( size < face->type1.private_dict.lenIV )
|
|
1864 |
+ if ( size < (FT_ULong)face->type1.private_dict.lenIV )
|
|
1865 | 1865 |
{
|
1866 | 1866 |
error = FT_THROW( Invalid_File_Format );
|
1867 | 1867 |
goto Fail;
|
... | ... | @@ -1872,7 +1872,7 @@ |
1872 | 1872 |
goto Fail;
|
1873 | 1873 |
FT_MEM_COPY( temp, base, size );
|
1874 | 1874 |
psaux->t1_decrypt( temp, size, 4330 );
|
1875 |
- size -= face->type1.private_dict.lenIV;
|
|
1875 |
+ size -= (FT_ULong)face->type1.private_dict.lenIV;
|
|
1876 | 1876 |
error = T1_Add_Table( table, (FT_Int)idx,
|
1877 | 1877 |
temp + face->type1.private_dict.lenIV, size );
|
1878 | 1878 |
FT_FREE( temp );
|
... | ... | @@ -1977,7 +1977,7 @@ |
1977 | 1977 |
|
1978 | 1978 |
for (;;)
|
1979 | 1979 |
{
|
1980 |
- FT_Long size;
|
|
1980 |
+ FT_ULong size;
|
|
1981 | 1981 |
FT_Byte* base;
|
1982 | 1982 |
|
1983 | 1983 |
|
... | ... | @@ -2071,7 +2071,7 @@ |
2071 | 2071 |
FT_Byte* temp = NULL;
|
2072 | 2072 |
|
2073 | 2073 |
|
2074 |
- if ( size <= face->type1.private_dict.lenIV )
|
|
2074 |
+ if ( size <= (FT_ULong)face->type1.private_dict.lenIV )
|
|
2075 | 2075 |
{
|
2076 | 2076 |
error = FT_THROW( Invalid_File_Format );
|
2077 | 2077 |
goto Fail;
|
... | ... | @@ -2082,7 +2082,7 @@ |
2082 | 2082 |
goto Fail;
|
2083 | 2083 |
FT_MEM_COPY( temp, base, size );
|
2084 | 2084 |
psaux->t1_decrypt( temp, size, 4330 );
|
2085 |
- size -= face->type1.private_dict.lenIV;
|
|
2085 |
+ size -= (FT_ULong)face->type1.private_dict.lenIV;
|
|
2086 | 2086 |
error = T1_Add_Table( code_table, n,
|
2087 | 2087 |
temp + face->type1.private_dict.lenIV, size );
|
2088 | 2088 |
FT_FREE( temp );
|
... | ... | @@ -2334,7 +2334,7 @@ |
2334 | 2334 |
else if ( *cur == 'R' && cur + 6 < limit && *(cur + 1) == 'D' &&
|
2335 | 2335 |
have_integer )
|
2336 | 2336 |
{
|
2337 |
- FT_Long s;
|
|
2337 |
+ FT_ULong s;
|
|
2338 | 2338 |
FT_Byte* b;
|
2339 | 2339 |
|
2340 | 2340 |
|
... | ... | @@ -2347,7 +2347,7 @@ |
2347 | 2347 |
else if ( *cur == '-' && cur + 6 < limit && *(cur + 1) == '|' &&
|
2348 | 2348 |
have_integer )
|
2349 | 2349 |
{
|
2350 |
- FT_Long s;
|
|
2350 |
+ FT_ULong s;
|
|
2351 | 2351 |
FT_Byte* b;
|
2352 | 2352 |
|
2353 | 2353 |
|