ReactOS 0.4.15-dev-7788-g1ad9096
gxvcommn.h File Reference
#include <ft2build.h>
#include "gxvalid.h"
Include dependency graph for gxvcommn.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

union  GXV_LookupValueDesc_
 
union  GXV_StateTable_GlyphOffsetDesc_
 
struct  GXV_StateTable_ValidatorRec_
 
struct  GXV_XStateTable_ValidatorRec_
 
struct  GXV_ValidatorRec_
 
struct  GXV_odtect_DataRec_
 
struct  GXV_odtect_RangeRec_
 

Macros

#define IS_PARANOID_VALIDATION   ( gxvalid->root->level >= FT_VALIDATE_PARANOID )
 
#define GXV_SET_ERR_IF_PARANOID(err)   { if ( IS_PARANOID_VALIDATION ) ( err ); }
 
#define DUMMY_LIMIT   0
 
#define GXV_GLYPHOFFSET_FMT(table)    ( gxvalid->table.entry_glyphoffset_fmt )
 
#define GXV_GLYPHOFFSET_SIZE(table)    ( gxvalid->table.entry_glyphoffset_fmt / 2 )
 
#define GXV_TABLE_DATA(tag, field)    ( ( (GXV_ ## tag ## _Data)gxvalid->table_data )->field )
 
#define FT_INVALID_(_error)    ft_validator_error( gxvalid->root, FT_THROW( _error ) )
 
#define GXV_LIMIT_CHECK(_count)
 
#define GXV_INIT   do { } while ( 0 )
 
#define GXV_NAME_ENTER(name)   do { } while ( 0 )
 
#define GXV_EXIT   do { } while ( 0 )
 
#define GXV_TRACE(s)   do { } while ( 0 )
 
#define GXV_32BIT_ALIGNMENT_VALIDATE(a)
 
#define GXV_TRACE_HEXDUMP(p, len)
 
#define GXV_TRACE_HEXDUMP_C(p, len)
 
#define GXV_TRACE_HEXDUMP_SFNTNAME(n)    GXV_TRACE_HEXDUMP( n.string, n.string_len )
 
#define GXV_SUBTABLE_OFFSET_CHECK(_offset)
 
#define GXV_SUBTABLE_LIMIT_CHECK(_count)
 
#define GXV_USHORT_TO_SHORT(_us)    ( ( 0x8000U < ( _us ) ) ? ( ( _us ) - 0x8000U ) : ( _us ) )
 
#define GXV_STATETABLE_HEADER_SIZE   ( 2 + 2 + 2 + 2 )
 
#define GXV_STATEHEADER_SIZE   GXV_STATETABLE_HEADER_SIZE
 
#define GXV_XSTATETABLE_HEADER_SIZE   ( 4 + 4 + 4 + 4 )
 
#define GXV_XSTATEHEADER_SIZE   GXV_XSTATETABLE_HEADER_SIZE
 
#define GXV_ODTECT(n, odtect)
 
#define GXV_ODTECT_INIT(odtect)
 

Typedefs

typedef struct GXV_ValidatorRec_GXV_Validator
 
typedef void(* GXV_Validate_Func) (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
typedef union GXV_LookupValueDesc_ GXV_LookupValueDesc
 
typedef const GXV_LookupValueDescGXV_LookupValueCPtr
 
typedef enum GXV_LookupValue_SignSpec_ GXV_LookupValue_SignSpec
 
typedef void(* GXV_Lookup_Value_Validate_Func) (FT_UShort glyph, GXV_LookupValueCPtr value_p, GXV_Validator gxvalid)
 
typedef GXV_LookupValueDesc(* GXV_Lookup_Fmt4_Transit_Func) (FT_UShort relative_gindex, GXV_LookupValueCPtr base_value_p, FT_Bytes lookuptbl_limit, GXV_Validator gxvalid)
 
typedef enum GXV_GlyphOffset_Format_ GXV_GlyphOffset_Format
 
typedef union GXV_StateTable_GlyphOffsetDesc_ GXV_StateTable_GlyphOffsetDesc
 
typedef const GXV_StateTable_GlyphOffsetDescGXV_StateTable_GlyphOffsetCPtr
 
typedef void(* GXV_StateTable_Subtable_Setup_Func) (FT_UShort table_size, FT_UShort classTable, FT_UShort stateArray, FT_UShort entryTable, FT_UShort *classTable_length_p, FT_UShort *stateArray_length_p, FT_UShort *entryTable_length_p, GXV_Validator gxvalid)
 
typedef void(* GXV_StateTable_Entry_Validate_Func) (FT_Byte state, FT_UShort flags, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p, FT_Bytes statetable_table, FT_Bytes statetable_limit, GXV_Validator gxvalid)
 
typedef void(* GXV_StateTable_OptData_Load_Func) (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
typedef struct GXV_StateTable_ValidatorRec_ GXV_StateTable_ValidatorRec
 
typedef struct GXV_StateTable_ValidatorRec_GXV_StateTable_ValidatorRecData
 
typedef GXV_StateTable_GlyphOffsetDesc GXV_XStateTable_GlyphOffsetDesc
 
typedef const GXV_XStateTable_GlyphOffsetDescGXV_XStateTable_GlyphOffsetCPtr
 
typedef void(* GXV_XStateTable_Subtable_Setup_Func) (FT_ULong table_size, FT_ULong classTable, FT_ULong stateArray, FT_ULong entryTable, FT_ULong *classTable_length_p, FT_ULong *stateArray_length_p, FT_ULong *entryTable_length_p, GXV_Validator gxvalid)
 
typedef void(* GXV_XStateTable_Entry_Validate_Func) (FT_UShort state, FT_UShort flags, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p, FT_Bytes xstatetable_table, FT_Bytes xstatetable_limit, GXV_Validator gxvalid)
 
typedef GXV_StateTable_OptData_Load_Func GXV_XStateTable_OptData_Load_Func
 
typedef struct GXV_XStateTable_ValidatorRec_ GXV_XStateTable_ValidatorRec
 
typedef struct GXV_XStateTable_ValidatorRec_GXV_XStateTable_ValidatorRecData
 
typedef struct GXV_ValidatorRec_ GXV_ValidatorRec
 
typedef struct GXV_odtect_DataRec_ GXV_odtect_DataRec
 
typedef struct GXV_odtect_DataRec_GXV_odtect_Data
 
typedef struct GXV_odtect_RangeRec_ GXV_odtect_RangeRec
 
typedef struct GXV_odtect_RangeRec_GXV_odtect_Range
 

Enumerations

enum  GXV_LookupValue_SignSpec_ { GXV_LOOKUPVALUE_UNSIGNED = 0 , GXV_LOOKUPVALUE_SIGNED }
 
enum  GXV_GlyphOffset_Format_ {
  GXV_GLYPHOFFSET_NONE = -1 , GXV_GLYPHOFFSET_UCHAR = 2 , GXV_GLYPHOFFSET_CHAR , GXV_GLYPHOFFSET_USHORT = 4 ,
  GXV_GLYPHOFFSET_SHORT , GXV_GLYPHOFFSET_ULONG = 8 , GXV_GLYPHOFFSET_LONG
}
 

Functions

 gxv_BinSrchHeader_validate (FT_Bytes p, FT_Bytes limit, FT_UShort *unitSize_p, FT_UShort *nUnits_p, GXV_Validator gxvalid)
 
 gxv_LookupTable_validate (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
 gxv_glyphid_validate (FT_UShort gid, GXV_Validator gxvalid)
 
 gxv_ctlPoint_validate (FT_UShort gid, FT_UShort ctl_point, GXV_Validator gxvalid)
 
 gxv_sfntName_validate (FT_UShort name_index, FT_UShort min_index, FT_UShort max_index, GXV_Validator gxvalid)
 
 gxv_StateTable_subtable_setup (FT_UShort table_size, FT_UShort classTable, FT_UShort stateArray, FT_UShort entryTable, FT_UShort *classTable_length_p, FT_UShort *stateArray_length_p, FT_UShort *entryTable_length_p, GXV_Validator gxvalid)
 
 gxv_XStateTable_subtable_setup (FT_ULong table_size, FT_ULong classTable, FT_ULong stateArray, FT_ULong entryTable, FT_ULong *classTable_length_p, FT_ULong *stateArray_length_p, FT_ULong *entryTable_length_p, GXV_Validator gxvalid)
 
 gxv_StateTable_validate (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
 gxv_XStateTable_validate (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
 gxv_array_getlimits_byte (FT_Bytes table, FT_Bytes limit, FT_Byte *min, FT_Byte *max, GXV_Validator gxvalid)
 
 gxv_array_getlimits_ushort (FT_Bytes table, FT_Bytes limit, FT_UShort *min, FT_UShort *max, GXV_Validator gxvalid)
 
 gxv_set_length_by_ushort_offset (FT_UShort *offset, FT_UShort **length, FT_UShort *buff, FT_UInt nmemb, FT_UShort limit, GXV_Validator gxvalid)
 
 gxv_set_length_by_ulong_offset (FT_ULong *offset, FT_ULong **length, FT_ULong *buff, FT_UInt nmemb, FT_ULong limit, GXV_Validator gxvalid)
 
 gxv_odtect_add_range (FT_Bytes start, FT_ULong length, const FT_String *name, GXV_odtect_Range odtect)
 
 gxv_odtect_validate (GXV_odtect_Range odtect, GXV_Validator gxvalid)
 

Macro Definition Documentation

◆ DUMMY_LIMIT

#define DUMMY_LIMIT   0

Definition at line 79 of file gxvcommn.h.

◆ FT_INVALID_

#define FT_INVALID_ (   _error)     ft_validator_error( gxvalid->root, FT_THROW( _error ) )

Definition at line 269 of file gxvcommn.h.

◆ GXV_32BIT_ALIGNMENT_VALIDATE

#define GXV_32BIT_ALIGNMENT_VALIDATE (   a)
Value:
{ \
if ( (a) & 3 ) \
} \
#define FT_END_STMNT
Definition: ftconfig.h:353
#define FT_BEGIN_STMNT
Definition: ftconfig.h:352
#define FT_INVALID_OFFSET
Definition: ftvalid.h:138
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Definition at line 317 of file gxvcommn.h.

◆ GXV_EXIT

#define GXV_EXIT   do { } while ( 0 )

Definition at line 302 of file gxvcommn.h.

◆ GXV_GLYPHOFFSET_FMT

#define GXV_GLYPHOFFSET_FMT (   table)     ( gxvalid->table.entry_glyphoffset_fmt )

Definition at line 133 of file gxvcommn.h.

◆ GXV_GLYPHOFFSET_SIZE

#define GXV_GLYPHOFFSET_SIZE (   table)     ( gxvalid->table.entry_glyphoffset_fmt / 2 )

Definition at line 136 of file gxvcommn.h.

◆ GXV_INIT

#define GXV_INIT   do { } while ( 0 )

Definition at line 300 of file gxvcommn.h.

◆ GXV_LIMIT_CHECK

#define GXV_LIMIT_CHECK (   _count)
Value:
FT_BEGIN_STMNT \
if ( p + _count > ( limit? limit : gxvalid->root->limit ) ) \
#define FT_INVALID_TOO_SHORT
Definition: ftvalid.h:134
GLint limit
Definition: glext.h:10326
GLfloat GLfloat p
Definition: glext.h:8902

Definition at line 272 of file gxvcommn.h.

◆ GXV_NAME_ENTER

#define GXV_NAME_ENTER (   name)    do { } while ( 0 )

Definition at line 301 of file gxvcommn.h.

◆ GXV_ODTECT

#define GXV_ODTECT (   n,
  odtect 
)
Value:
GXV_odtect_DataRec odtect ## _range[n]; \
GXV_odtect_RangeRec odtect ## _rec = { 0, NULL }; \
#define NULL
Definition: types.h:112
GLdouble n
Definition: glext.h:7729

Definition at line 562 of file gxvcommn.h.

◆ GXV_ODTECT_INIT

#define GXV_ODTECT_INIT (   odtect)
Value:
FT_BEGIN_STMNT \
odtect ## _rec.nRanges = 0; \
odtect ## _rec.range = odtect ## _range; \
odtect = & odtect ## _rec; \

Definition at line 567 of file gxvcommn.h.

◆ GXV_SET_ERR_IF_PARANOID

#define GXV_SET_ERR_IF_PARANOID (   err)    { if ( IS_PARANOID_VALIDATION ) ( err ); }

Definition at line 66 of file gxvcommn.h.

◆ GXV_STATEHEADER_SIZE

#define GXV_STATEHEADER_SIZE   GXV_STATETABLE_HEADER_SIZE

Definition at line 521 of file gxvcommn.h.

◆ GXV_STATETABLE_HEADER_SIZE

#define GXV_STATETABLE_HEADER_SIZE   ( 2 + 2 + 2 + 2 )

Definition at line 520 of file gxvcommn.h.

◆ GXV_SUBTABLE_LIMIT_CHECK

#define GXV_SUBTABLE_LIMIT_CHECK (   _count)
Value:
FT_BEGIN_STMNT \
if ( ( p + (_count) - gxvalid->subtable_start ) > \
gxvalid->subtable_length ) \

Definition at line 510 of file gxvcommn.h.

◆ GXV_SUBTABLE_OFFSET_CHECK

#define GXV_SUBTABLE_OFFSET_CHECK (   _offset)
Value:
FT_BEGIN_STMNT \
if ( (_offset) > gxvalid->subtable_length ) \

Definition at line 504 of file gxvcommn.h.

◆ GXV_TABLE_DATA

#define GXV_TABLE_DATA (   tag,
  field 
)     ( ( (GXV_ ## tag ## _Data)gxvalid->table_data )->field )

Definition at line 265 of file gxvcommn.h.

◆ GXV_TRACE

#define GXV_TRACE (   s)    do { } while ( 0 )

Definition at line 304 of file gxvcommn.h.

◆ GXV_TRACE_HEXDUMP

#define GXV_TRACE_HEXDUMP (   p,
  len 
)
Value:
{ \
\
\
for ( b = p; b < (FT_Bytes)p + len; b++ ) \
FT_TRACE1(("\\x%02x", *b)); \
} \
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
const FT_Byte * FT_Bytes
Definition: fttypes.h:165
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLsizei len
Definition: glext.h:6722
#define b
Definition: ke_i.h:79

Definition at line 334 of file gxvcommn.h.

◆ GXV_TRACE_HEXDUMP_C

#define GXV_TRACE_HEXDUMP_C (   p,
  len 
)
Value:
{ \
\
\
for ( b = p; b < (FT_Bytes)p + len; b++ ) \
if ( 0x40 < *b && *b < 0x7E ) \
FT_TRACE1(("%c", *b)); \
else \
FT_TRACE1(("\\x%02x", *b)); \
} \

Definition at line 345 of file gxvcommn.h.

◆ GXV_TRACE_HEXDUMP_SFNTNAME

#define GXV_TRACE_HEXDUMP_SFNTNAME (   n)     GXV_TRACE_HEXDUMP( n.string, n.string_len )

Definition at line 359 of file gxvcommn.h.

◆ GXV_USHORT_TO_SHORT

#define GXV_USHORT_TO_SHORT (   _us)     ( ( 0x8000U < ( _us ) ) ? ( ( _us ) - 0x8000U ) : ( _us ) )

Definition at line 517 of file gxvcommn.h.

◆ GXV_XSTATEHEADER_SIZE

#define GXV_XSTATEHEADER_SIZE   GXV_XSTATETABLE_HEADER_SIZE

Definition at line 524 of file gxvcommn.h.

◆ GXV_XSTATETABLE_HEADER_SIZE

#define GXV_XSTATETABLE_HEADER_SIZE   ( 4 + 4 + 4 + 4 )

Definition at line 523 of file gxvcommn.h.

◆ IS_PARANOID_VALIDATION

#define IS_PARANOID_VALIDATION   ( gxvalid->root->level >= FT_VALIDATE_PARANOID )

Definition at line 65 of file gxvcommn.h.

Typedef Documentation

◆ GXV_GlyphOffset_Format

◆ GXV_Lookup_Fmt4_Transit_Func

typedef GXV_LookupValueDesc(* GXV_Lookup_Fmt4_Transit_Func) (FT_UShort relative_gindex, GXV_LookupValueCPtr base_value_p, FT_Bytes lookuptbl_limit, GXV_Validator gxvalid)

Definition at line 111 of file gxvcommn.h.

◆ GXV_Lookup_Value_Validate_Func

typedef void(* GXV_Lookup_Value_Validate_Func) (FT_UShort glyph, GXV_LookupValueCPtr value_p, GXV_Validator gxvalid)

Definition at line 106 of file gxvcommn.h.

◆ GXV_LookupValue_SignSpec

◆ GXV_LookupValueCPtr

Definition at line 96 of file gxvcommn.h.

◆ GXV_LookupValueDesc

◆ GXV_odtect_Data

◆ GXV_odtect_DataRec

◆ GXV_odtect_Range

◆ GXV_odtect_RangeRec

◆ GXV_StateTable_Entry_Validate_Func

typedef void(* GXV_StateTable_Entry_Validate_Func) (FT_Byte state, FT_UShort flags, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p, FT_Bytes statetable_table, FT_Bytes statetable_limit, GXV_Validator gxvalid)

Definition at line 165 of file gxvcommn.h.

◆ GXV_StateTable_GlyphOffsetCPtr

◆ GXV_StateTable_GlyphOffsetDesc

◆ GXV_StateTable_OptData_Load_Func

typedef void(* GXV_StateTable_OptData_Load_Func) (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)

Definition at line 174 of file gxvcommn.h.

◆ GXV_StateTable_Subtable_Setup_Func

typedef void(* GXV_StateTable_Subtable_Setup_Func) (FT_UShort table_size, FT_UShort classTable, FT_UShort stateArray, FT_UShort entryTable, FT_UShort *classTable_length_p, FT_UShort *stateArray_length_p, FT_UShort *entryTable_length_p, GXV_Validator gxvalid)

Definition at line 155 of file gxvcommn.h.

◆ GXV_StateTable_ValidatorRec

◆ GXV_StateTable_ValidatorRecData

◆ GXV_Validate_Func

typedef void(* GXV_Validate_Func) (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)

Definition at line 81 of file gxvcommn.h.

◆ GXV_Validator

Definition at line 76 of file gxvcommn.h.

◆ GXV_ValidatorRec

◆ GXV_XStateTable_Entry_Validate_Func

typedef void(* GXV_XStateTable_Entry_Validate_Func) (FT_UShort state, FT_UShort flags, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p, FT_Bytes xstatetable_table, FT_Bytes xstatetable_limit, GXV_Validator gxvalid)

Definition at line 207 of file gxvcommn.h.

◆ GXV_XStateTable_GlyphOffsetCPtr

◆ GXV_XStateTable_GlyphOffsetDesc

◆ GXV_XStateTable_OptData_Load_Func

◆ GXV_XStateTable_Subtable_Setup_Func

typedef void(* GXV_XStateTable_Subtable_Setup_Func) (FT_ULong table_size, FT_ULong classTable, FT_ULong stateArray, FT_ULong entryTable, FT_ULong *classTable_length_p, FT_ULong *stateArray_length_p, FT_ULong *entryTable_length_p, GXV_Validator gxvalid)

Definition at line 197 of file gxvcommn.h.

◆ GXV_XStateTable_ValidatorRec

◆ GXV_XStateTable_ValidatorRecData

Enumeration Type Documentation

◆ GXV_GlyphOffset_Format_

Enumerator
GXV_GLYPHOFFSET_NONE 
GXV_GLYPHOFFSET_UCHAR 
GXV_GLYPHOFFSET_CHAR 
GXV_GLYPHOFFSET_USHORT 
GXV_GLYPHOFFSET_SHORT 
GXV_GLYPHOFFSET_ULONG 
GXV_GLYPHOFFSET_LONG 

Definition at line 120 of file gxvcommn.h.

121 {
129
enum GXV_GlyphOffset_Format_ GXV_GlyphOffset_Format
@ GXV_GLYPHOFFSET_SHORT
Definition: gxvcommn.h:126
@ GXV_GLYPHOFFSET_CHAR
Definition: gxvcommn.h:124
@ GXV_GLYPHOFFSET_USHORT
Definition: gxvcommn.h:125
@ GXV_GLYPHOFFSET_UCHAR
Definition: gxvcommn.h:123
@ GXV_GLYPHOFFSET_NONE
Definition: gxvcommn.h:122
@ GXV_GLYPHOFFSET_LONG
Definition: gxvcommn.h:128
@ GXV_GLYPHOFFSET_ULONG
Definition: gxvcommn.h:127

◆ GXV_LookupValue_SignSpec_

Enumerator
GXV_LOOKUPVALUE_UNSIGNED 
GXV_LOOKUPVALUE_SIGNED 

Definition at line 98 of file gxvcommn.h.

99 {
102
@ GXV_LOOKUPVALUE_SIGNED
Definition: gxvcommn.h:101
@ GXV_LOOKUPVALUE_UNSIGNED
Definition: gxvcommn.h:100
enum GXV_LookupValue_SignSpec_ GXV_LookupValue_SignSpec

Function Documentation

◆ gxv_array_getlimits_byte()

gxv_array_getlimits_byte ( FT_Bytes  table,
FT_Bytes  limit,
FT_Byte min,
FT_Byte max,
GXV_Validator  gxvalid 
)

Definition at line 181 of file gxvcommn.c.

186 {
187 FT_Bytes p = table;
188
189
190 *min = 0xFF;
191 *max = 0x00;
192
193 while ( p < limit )
194 {
195 FT_Byte val;
196
197
198 GXV_LIMIT_CHECK( 1 );
199 val = FT_NEXT_BYTE( p );
200
201 *min = (FT_Byte)FT_MIN( *min, val );
202 *max = (FT_Byte)FT_MAX( *max, val );
203 }
204
205 gxvalid->subtable_length = (FT_ULong)( p - table );
206 }
#define FT_MIN(a, b)
Definition: ftobjs.h:71
#define FT_MAX(a, b)
Definition: ftobjs.h:72
#define FT_NEXT_BYTE(buffer)
Definition: ftstream.h:220
unsigned long FT_ULong
Definition: fttypes.h:253
unsigned char FT_Byte
Definition: fttypes.h:154
GLuint GLfloat * val
Definition: glext.h:7180
#define GXV_LIMIT_CHECK(_count)
Definition: gxvcommn.h:272
#define min(a, b)
Definition: monoChain.cc:55
FT_ULong subtable_length
Definition: gxvcommn.h:244
#define max(a, b)
Definition: svc.c:63

Referenced by gxv_kern_subtable_fmt3_validate().

◆ gxv_array_getlimits_ushort()

gxv_array_getlimits_ushort ( FT_Bytes  table,
FT_Bytes  limit,
FT_UShort min,
FT_UShort max,
GXV_Validator  gxvalid 
)

Definition at line 210 of file gxvcommn.c.

215 {
216 FT_Bytes p = table;
217
218
219 *min = 0xFFFFU;
220 *max = 0x0000;
221
222 while ( p < limit )
223 {
225
226
227 GXV_LIMIT_CHECK( 2 );
228 val = FT_NEXT_USHORT( p );
229
230 *min = (FT_Byte)FT_MIN( *min, val );
231 *max = (FT_Byte)FT_MAX( *max, val );
232 }
233
234 gxvalid->subtable_length = (FT_ULong)( p - table );
235 }
#define FT_NEXT_USHORT(buffer)
Definition: ftstream.h:226
unsigned short FT_UShort
Definition: fttypes.h:209

Referenced by gxv_kern_subtable_fmt2_clstbl_validate().

◆ gxv_BinSrchHeader_validate()

gxv_BinSrchHeader_validate ( FT_Bytes  p,
FT_Bytes  limit,
FT_UShort unitSize_p,
FT_UShort nUnits_p,
GXV_Validator  gxvalid 
)

Definition at line 328 of file gxvcommn.c.

333 {
334 FT_Bytes p = table;
335 GXV_BinSrchHeader binSrchHeader;
336
337
338 GXV_NAME_ENTER( "BinSrchHeader validate" );
339
340 if ( *unitSize_p == 0 )
341 {
342 GXV_LIMIT_CHECK( 2 );
343 binSrchHeader.unitSize = FT_NEXT_USHORT( p );
344 }
345 else
346 binSrchHeader.unitSize = *unitSize_p;
347
348 if ( *nUnits_p == 0 )
349 {
350 GXV_LIMIT_CHECK( 2 );
351 binSrchHeader.nUnits = FT_NEXT_USHORT( p );
352 }
353 else
354 binSrchHeader.nUnits = *nUnits_p;
355
356 GXV_LIMIT_CHECK( 2 + 2 + 2 );
357 binSrchHeader.searchRange = FT_NEXT_USHORT( p );
358 binSrchHeader.entrySelector = FT_NEXT_USHORT( p );
359 binSrchHeader.rangeShift = FT_NEXT_USHORT( p );
360 GXV_TRACE(( "nUnits %d\n", binSrchHeader.nUnits ));
361
362 gxv_BinSrchHeader_check_consistency( &binSrchHeader, gxvalid );
363
364 if ( *unitSize_p == 0 )
365 *unitSize_p = binSrchHeader.unitSize;
366
367 if ( *nUnits_p == 0 )
368 *nUnits_p = binSrchHeader.nUnits;
369
370 gxvalid->subtable_length = (FT_ULong)( p - table );
371 GXV_EXIT;
372 }
static void gxv_BinSrchHeader_check_consistency(GXV_BinSrchHeader *binSrchHeader, GXV_Validator gxvalid)
Definition: gxvcommn.c:258
#define GXV_NAME_ENTER(name)
Definition: gxvcommn.h:301
#define GXV_TRACE(s)
Definition: gxvcommn.h:304
#define GXV_EXIT
Definition: gxvcommn.h:302
FT_UShort searchRange
Definition: gxvcommn.c:250
FT_UShort rangeShift
Definition: gxvcommn.c:252
FT_UShort nUnits
Definition: gxvcommn.c:249
FT_UShort unitSize
Definition: gxvcommn.c:248
FT_UShort entrySelector
Definition: gxvcommn.c:251

Referenced by gxv_kern_subtable_fmt0_validate(), gxv_LookupTable_fmt2_validate(), gxv_LookupTable_fmt4_validate(), and gxv_LookupTable_fmt6_validate().

◆ gxv_ctlPoint_validate()

gxv_ctlPoint_validate ( FT_UShort  gid,
FT_UShort  ctl_point,
GXV_Validator  gxvalid 
)

Definition at line 846 of file gxvcommn.c.

849 {
852
853 FT_GlyphSlot glyph;
855 FT_UShort n_points;
856
857
858 face = gxvalid->face;
859
861 gid,
863 if ( error )
865
866 glyph = face->glyph;
867 outline = glyph->outline;
868 n_points = (FT_UShort)outline.n_points;
869
870 if ( !( ctl_point < n_points ) )
872 }
WORD face[3]
Definition: mesh.c:4747
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:760
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3012
#define FT_LOAD_IGNORE_TRANSFORM
Definition: freetype.h:3019
int FT_Error
Definition: fttypes.h:300
#define FT_INVALID_DATA
Definition: ftvalid.h:150
#define FT_INVALID_GLYPH_ID
Definition: ftvalid.h:146
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
if(dx< 0)
Definition: linetemp.h:194
#define error(str)
Definition: mkdosfs.c:1605
FT_Outline outline
Definition: freetype.h:1927
Definition: mesh.c:5330

Referenced by gxv_bsln_parts_fmt2_validate(), gxv_lcar_partial_validate(), and gxv_opbd_LookupValue_validate().

◆ gxv_glyphid_validate()

gxv_glyphid_validate ( FT_UShort  gid,
GXV_Validator  gxvalid 
)

Definition at line 813 of file gxvcommn.c.

815 {
817
818
819 if ( gid == 0xFFFFU )
820 {
821 GXV_EXIT;
822 return 1;
823 }
824
825 face = gxvalid->face;
826 if ( face->num_glyphs < gid )
827 {
828 GXV_TRACE(( " gxv_glyphid_check() gid overflow: num_glyphs %d < %d\n",
829 face->num_glyphs, gid ));
831 }
832
833 return 0;
834 }
#define GXV_SET_ERR_IF_PARANOID(err)
Definition: gxvcommn.h:66

Referenced by gxv_bsln_parts_fmt2_validate(), gxv_ClassTable_validate(), gxv_kern_subtable_fmt0_pairs_validate(), gxv_kern_subtable_fmt2_clstbl_validate(), gxv_LookupTable_fmt2_validate(), gxv_LookupTable_fmt4_validate(), gxv_LookupTable_fmt6_validate(), gxv_LookupTable_fmt8_validate(), gxv_mort_subtable_type4_lookupval_validate(), and gxv_prop_property_validate().

◆ gxv_LookupTable_validate()

gxv_LookupTable_validate ( FT_Bytes  table,
FT_Bytes  limit,
GXV_Validator  gxvalid 
)

Definition at line 755 of file gxvcommn.c.

758 {
759 FT_Bytes p = table;
761
762 GXV_Validate_Func fmt_funcs_table[] =
763 {
765 NULL, /* 1 */
767 NULL, /* 3 */
769 NULL, /* 5 */
771 NULL, /* 7 */
773 };
774
776
777
778 GXV_NAME_ENTER( "LookupTable" );
779
780 /* lookuptbl_head may be used in fmt4 transit function. */
781 gxvalid->lookuptbl_head = table;
782
783 /* format */
784 GXV_LIMIT_CHECK( 2 );
786 GXV_TRACE(( " (format %d)\n", format ));
787
788 if ( format > 8 )
790
791 func = fmt_funcs_table[format];
792 if ( !func )
794
795 func( p, limit, gxvalid );
796 p += gxvalid->subtable_length;
797
798 gxvalid->subtable_length = (FT_ULong)( p - table );
799
800 GXV_EXIT;
801 }
#define FT_INVALID_FORMAT
Definition: ftvalid.h:142
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLenum func
Definition: glext.h:6028
static void gxv_LookupTable_fmt6_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:665
static void gxv_LookupTable_fmt0_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:423
static void gxv_LookupTable_fmt8_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:719
static void gxv_LookupTable_fmt4_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:565
static void gxv_LookupTable_fmt2_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:494
void(* GXV_Validate_Func)(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvcommn.h:82
FT_Bytes lookuptbl_head
Definition: gxvcommn.h:249

Referenced by gxv_bsln_parts_fmt1_validate(), gxv_bsln_parts_fmt3_validate(), gxv_just_justData_lookuptable_validate(), gxv_just_pcLookupTable_validate(), gxv_lcar_validate(), gxv_mort_subtable_type4_validate(), gxv_morx_subtable_type1_substitutionTable_validate(), gxv_opbd_validate(), gxv_prop_validate(), and gxv_XStateTable_validate().

◆ gxv_odtect_add_range()

gxv_odtect_add_range ( FT_Bytes  start,
FT_ULong  length,
const FT_String name,
GXV_odtect_Range  odtect 
)

Definition at line 1702 of file gxvcommn.c.

1706 {
1707 odtect->range[odtect->nRanges].start = start;
1708 odtect->range[odtect->nRanges].length = length;
1709 odtect->range[odtect->nRanges].name = (FT_String*)name;
1710 odtect->nRanges++;
1711 }
char FT_String
Definition: fttypes.h:187
GLuint start
Definition: gl.h:1545
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
FT_String * name
Definition: gxvcommn.h:539
GXV_odtect_Data range
Definition: gxvcommn.h:546
Definition: name.c:39

Referenced by gxv_just_justData_validate(), gxv_just_validate(), gxv_kern_subtable_fmt2_clstbl_validate(), gxv_kern_subtable_fmt2_validate(), gxv_trak_trackData_validate(), and gxv_trak_validate().

◆ gxv_odtect_validate()

gxv_odtect_validate ( GXV_odtect_Range  odtect,
GXV_Validator  gxvalid 
)

Definition at line 1715 of file gxvcommn.c.

1717 {
1718 FT_UInt i, j;
1719
1720
1721 GXV_NAME_ENTER( "check overlap among multi ranges" );
1722
1723 for ( i = 0; i < odtect->nRanges; i++ )
1724 for ( j = 0; j < i; j++ )
1725 if ( 0 != gxv_compare_ranges( odtect->range[i].start,
1726 odtect->range[i].length,
1727 odtect->range[j].start,
1728 odtect->range[j].length ) )
1729 {
1730#ifdef FT_DEBUG_LEVEL_TRACE
1731 if ( odtect->range[i].name || odtect->range[j].name )
1732 GXV_TRACE(( "found overlap between range %d and range %d\n",
1733 i, j ));
1734 else
1735 GXV_TRACE(( "found overlap between `%s' and `%s\'\n",
1736 odtect->range[i].name,
1737 odtect->range[j].name ));
1738#endif
1740 }
1741
1742 GXV_EXIT;
1743 }
unsigned int FT_UInt
Definition: fttypes.h:231
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static int gxv_compare_ranges(FT_Bytes table1_start, FT_ULong table1_length, FT_Bytes table2_start, FT_ULong table2_length)
Definition: gxvcommn.c:1674

Referenced by gxv_just_justData_validate(), gxv_just_validate(), gxv_kern_subtable_fmt2_validate(), gxv_trak_trackData_validate(), and gxv_trak_validate().

◆ gxv_set_length_by_ulong_offset()

gxv_set_length_by_ulong_offset ( FT_ULong offset,
FT_ULong **  length,
FT_ULong buff,
FT_UInt  nmemb,
FT_ULong  limit,
GXV_Validator  gxvalid 
)

Definition at line 128 of file gxvcommn.c.

134 {
135 FT_UInt i;
136
137
138 for ( i = 0; i < nmemb; i++ )
139 *(length[i]) = 0;
140
141 for ( i = 0; i < nmemb; i++ )
142 buff[i] = offset[i];
143 buff[nmemb] = limit;
144
145 ft_qsort( buff, ( nmemb + 1 ), sizeof ( FT_ULong ),
146 ( int(*)(const void*, const void*) )gxv_compare_ulong_offset );
147
148 if ( buff[nmemb] > limit )
150
151 for ( i = 0; i < nmemb; i++ )
152 {
153 FT_UInt j;
154
155
156 for ( j = 0; j < nmemb; j++ )
157 if ( buff[j] == offset[i] )
158 break;
159
160 if ( j == nmemb )
162
163 *(length[i]) = buff[j + 1] - buff[j];
164
165 if ( 0 != offset[i] && 0 == *(length[i]) )
167 }
168 }
static unsigned char buff[32768]
Definition: fatten.c:17
#define ft_qsort
Definition: ftstdlib.h:122
GLintptr offset
Definition: glext.h:5920
static int gxv_compare_ulong_offset(FT_ULong *a, FT_ULong *b)
Definition: gxvcommn.c:115

Referenced by gxv_morx_subtable_type1_subtable_setup(), gxv_morx_subtable_type2_subtable_setup(), gxv_morx_subtable_type5_subtable_setup(), and gxv_XStateTable_subtable_setup().

◆ gxv_set_length_by_ushort_offset()

gxv_set_length_by_ushort_offset ( FT_UShort offset,
FT_UShort **  length,
FT_UShort buff,
FT_UInt  nmemb,
FT_UShort  limit,
GXV_Validator  gxvalid 
)

Definition at line 63 of file gxvcommn.c.

69 {
70 FT_UInt i;
71
72
73 for ( i = 0; i < nmemb; i++ )
74 *(length[i]) = 0;
75
76 for ( i = 0; i < nmemb; i++ )
77 buff[i] = offset[i];
78 buff[nmemb] = limit;
79
80 ft_qsort( buff, ( nmemb + 1 ), sizeof ( FT_UShort ),
81 ( int(*)(const void*, const void*) )gxv_compare_ushort_offset );
82
83 if ( buff[nmemb] > limit )
85
86 for ( i = 0; i < nmemb; i++ )
87 {
88 FT_UInt j;
89
90
91 for ( j = 0; j < nmemb; j++ )
92 if ( buff[j] == offset[i] )
93 break;
94
95 if ( j == nmemb )
97
98 *(length[i]) = (FT_UShort)( buff[j + 1] - buff[j] );
99
100 if ( 0 != offset[i] && 0 == *(length[i]) )
102 }
103 }
static int gxv_compare_ushort_offset(FT_UShort *a, FT_UShort *b)
Definition: gxvcommn.c:50

Referenced by gxv_kern_subtable_fmt1_subtable_setup(), gxv_mort_subtable_type1_subtable_setup(), gxv_mort_subtable_type2_subtable_setup(), and gxv_StateTable_subtable_setup().

◆ gxv_sfntName_validate()

gxv_sfntName_validate ( FT_UShort  name_index,
FT_UShort  min_index,
FT_UShort  max_index,
GXV_Validator  gxvalid 
)

Definition at line 884 of file gxvcommn.c.

888 {
890 FT_UInt i;
891 FT_UInt nnames;
892
893
894 GXV_NAME_ENTER( "sfntName" );
895
896 if ( name_index < min_index || max_index < name_index )
898
899 nnames = FT_Get_Sfnt_Name_Count( gxvalid->face );
900 for ( i = 0; i < nnames; i++ )
901 {
902 if ( FT_Get_Sfnt_Name( gxvalid->face, i, &name ) != FT_Err_Ok )
903 continue;
904
905 if ( name.name_id == name_index )
906 goto Out;
907 }
908
909 GXV_TRACE(( " nameIndex = %d (UNTITLED)\n", name_index ));
911 goto Exit; /* make compiler happy */
912
913 Out:
914 FT_TRACE1(( " nameIndex = %d (", name_index ));
916 FT_TRACE1(( ")\n" ));
917
918 Exit:
919 GXV_EXIT;
920 }
@ Out
return FT_Err_Ok
Definition: ftbbox.c:511
FT_Get_Sfnt_Name_Count(FT_Face face)
FT_BEGIN_HEADER struct FT_SfntName_ FT_SfntName
FT_Get_Sfnt_Name(FT_Face face, FT_UInt idx, FT_SfntName *aname)
#define GXV_TRACE_HEXDUMP_SFNTNAME(n)
Definition: gxvcommn.h:359
static void Exit(void)
Definition: sock.c:1330

Referenced by gxv_feat_name_index_validate(), and gxv_trak_trackTable_validate().

◆ gxv_StateTable_subtable_setup()

gxv_StateTable_subtable_setup ( FT_UShort  table_size,
FT_UShort  classTable,
FT_UShort  stateArray,
FT_UShort  entryTable,
FT_UShort classTable_length_p,
FT_UShort stateArray_length_p,
FT_UShort entryTable_length_p,
GXV_Validator  gxvalid 
)

Definition at line 1182 of file gxvcommn.c.

1190 {
1191 FT_UShort o[3];
1192 FT_UShort* l[3];
1193 FT_UShort buff[4];
1194
1195
1196 o[0] = classTable;
1197 o[1] = stateArray;
1198 o[2] = entryTable;
1199 l[0] = classTable_length_p;
1200 l[1] = stateArray_length_p;
1201 l[2] = entryTable_length_p;
1202
1204 }
r l[0]
Definition: byte_order.h:168
gxv_set_length_by_ushort_offset(FT_UShort *offset, FT_UShort **length, FT_UShort *buff, FT_UInt nmemb, FT_UShort limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:63
LOCAL int table_size
Definition: write.c:65

Referenced by gxv_mort_subtable_type5_subtable_setup(), and gxv_StateTable_validate().

◆ gxv_StateTable_validate()

gxv_StateTable_validate ( FT_Bytes  table,
FT_Bytes  limit,
GXV_Validator  gxvalid 
)

Definition at line 1208 of file gxvcommn.c.

1211 {
1212 FT_UShort stateSize;
1213 FT_UShort classTable; /* offset to Class(Sub)Table */
1214 FT_UShort stateArray; /* offset to StateArray */
1215 FT_UShort entryTable; /* offset to EntryTable */
1216
1217 FT_UShort classTable_length;
1218 FT_UShort stateArray_length;
1219 FT_UShort entryTable_length;
1220 FT_Byte maxClassID;
1221 FT_Byte maxState;
1222 FT_Byte maxEntry;
1223
1225
1226 FT_Bytes p = table;
1227
1228
1229 GXV_NAME_ENTER( "StateTable" );
1230
1231 GXV_TRACE(( "StateTable header\n" ));
1232
1233 GXV_LIMIT_CHECK( 2 + 2 + 2 + 2 );
1234 stateSize = FT_NEXT_USHORT( p );
1235 classTable = FT_NEXT_USHORT( p );
1236 stateArray = FT_NEXT_USHORT( p );
1237 entryTable = FT_NEXT_USHORT( p );
1238
1239 GXV_TRACE(( "stateSize=0x%04x\n", stateSize ));
1240 GXV_TRACE(( "offset to classTable=0x%04x\n", classTable ));
1241 GXV_TRACE(( "offset to stateArray=0x%04x\n", stateArray ));
1242 GXV_TRACE(( "offset to entryTable=0x%04x\n", entryTable ));
1243
1244 if ( stateSize > 0xFF )
1246
1247 if ( gxvalid->statetable.optdata_load_func )
1248 gxvalid->statetable.optdata_load_func( p, limit, gxvalid );
1249
1250 if ( gxvalid->statetable.subtable_setup_func )
1251 setup_func = gxvalid->statetable.subtable_setup_func;
1252 else
1253 setup_func = gxv_StateTable_subtable_setup;
1254
1255 setup_func( (FT_UShort)( limit - table ),
1256 classTable,
1257 stateArray,
1258 entryTable,
1259 &classTable_length,
1260 &stateArray_length,
1261 &entryTable_length,
1262 gxvalid );
1263
1264 GXV_TRACE(( "StateTable Subtables\n" ));
1265
1266 if ( classTable != 0 )
1267 gxv_ClassTable_validate( table + classTable,
1268 &classTable_length,
1269 stateSize,
1270 &maxClassID,
1271 gxvalid );
1272 else
1273 maxClassID = (FT_Byte)( stateSize - 1 );
1274
1275 if ( stateArray != 0 )
1276 gxv_StateArray_validate( table + stateArray,
1277 &stateArray_length,
1278 maxClassID,
1279 stateSize,
1280 &maxState,
1281 &maxEntry,
1282 gxvalid );
1283 else
1284 {
1285#if 0
1286 maxState = 1; /* 0:start of text, 1:start of line are predefined */
1287#endif
1288 maxEntry = 0;
1289 }
1290
1291 if ( maxEntry > 0 && entryTable == 0 )
1293
1294 if ( entryTable != 0 )
1295 gxv_EntryTable_validate( table + entryTable,
1296 &entryTable_length,
1297 maxEntry,
1298 stateArray,
1299 stateArray_length,
1300 maxClassID,
1301 table,
1302 limit,
1303 gxvalid );
1304
1305 GXV_EXIT;
1306 }
gxv_StateTable_subtable_setup(FT_UShort table_size, FT_UShort classTable, FT_UShort stateArray, FT_UShort entryTable, FT_UShort *classTable_length_p, FT_UShort *stateArray_length_p, FT_UShort *entryTable_length_p, GXV_Validator gxvalid)
Definition: gxvcommn.c:1182
static void gxv_StateArray_validate(FT_Bytes table, FT_UShort *length_p, FT_Byte maxClassID, FT_UShort stateSize, FT_Byte *maxState_p, FT_Byte *maxEntry_p, GXV_Validator gxvalid)
Definition: gxvcommn.c:1018
static void gxv_EntryTable_validate(FT_Bytes table, FT_UShort *length_p, FT_Byte maxEntry, FT_UShort stateArray, FT_UShort stateArray_length, FT_Byte maxClassID, FT_Bytes statetable_table, FT_Bytes statetable_limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:1070
static void gxv_ClassTable_validate(FT_Bytes table, FT_UShort *length_p, FT_UShort stateSize, FT_Byte *maxClassID_p, GXV_Validator gxvalid)
Definition: gxvcommn.c:942
void(* GXV_StateTable_Subtable_Setup_Func)(FT_UShort table_size, FT_UShort classTable, FT_UShort stateArray, FT_UShort entryTable, FT_UShort *classTable_length_p, FT_UShort *stateArray_length_p, FT_UShort *entryTable_length_p, GXV_Validator gxvalid)
Definition: gxvcommn.h:156
GXV_StateTable_Subtable_Setup_Func subtable_setup_func
Definition: gxvcommn.h:184
GXV_StateTable_OptData_Load_Func optdata_load_func
Definition: gxvcommn.h:186
GXV_StateTable_ValidatorRec statetable
Definition: gxvcommn.h:254

Referenced by gxv_just_justClassTable_validate(), gxv_kern_subtable_fmt1_validate(), gxv_mort_subtable_type0_validate(), gxv_mort_subtable_type1_validate(), gxv_mort_subtable_type2_validate(), and gxv_mort_subtable_type5_validate().

◆ gxv_XStateTable_subtable_setup()

gxv_XStateTable_subtable_setup ( FT_ULong  table_size,
FT_ULong  classTable,
FT_ULong  stateArray,
FT_ULong  entryTable,
FT_ULong classTable_length_p,
FT_ULong stateArray_length_p,
FT_ULong entryTable_length_p,
GXV_Validator  gxvalid 
)

Definition at line 1312 of file gxvcommn.c.

1320 {
1321 FT_ULong o[3];
1322 FT_ULong* l[3];
1323 FT_ULong buff[4];
1324
1325
1326 o[0] = classTable;
1327 o[1] = stateArray;
1328 o[2] = entryTable;
1329 l[0] = classTable_length_p;
1330 l[1] = stateArray_length_p;
1331 l[2] = entryTable_length_p;
1332
1333 gxv_set_length_by_ulong_offset( o, l, buff, 3, table_size, gxvalid );
1334 }
gxv_set_length_by_ulong_offset(FT_ULong *offset, FT_ULong **length, FT_ULong *buff, FT_UInt nmemb, FT_ULong limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:128

Referenced by gxv_XStateTable_validate().

◆ gxv_XStateTable_validate()

gxv_XStateTable_validate ( FT_Bytes  table,
FT_Bytes  limit,
GXV_Validator  gxvalid 
)

Definition at line 1554 of file gxvcommn.c.

1557 {
1558 /* StateHeader members */
1559 FT_ULong classTable; /* offset to Class(Sub)Table */
1560 FT_ULong stateArray; /* offset to StateArray */
1561 FT_ULong entryTable; /* offset to EntryTable */
1562
1563 FT_ULong classTable_length;
1564 FT_ULong stateArray_length;
1565 FT_ULong entryTable_length;
1566 FT_UShort maxState;
1567 FT_UShort maxEntry;
1568
1570
1571 FT_Bytes p = table;
1572
1573
1574 GXV_NAME_ENTER( "XStateTable" );
1575
1576 GXV_TRACE(( "XStateTable header\n" ));
1577
1578 GXV_LIMIT_CHECK( 4 + 4 + 4 + 4 );
1579 gxvalid->xstatetable.nClasses = FT_NEXT_ULONG( p );
1580 classTable = FT_NEXT_ULONG( p );
1581 stateArray = FT_NEXT_ULONG( p );
1582 entryTable = FT_NEXT_ULONG( p );
1583
1584 GXV_TRACE(( "nClasses =0x%08x\n", gxvalid->xstatetable.nClasses ));
1585 GXV_TRACE(( "offset to classTable=0x%08x\n", classTable ));
1586 GXV_TRACE(( "offset to stateArray=0x%08x\n", stateArray ));
1587 GXV_TRACE(( "offset to entryTable=0x%08x\n", entryTable ));
1588
1589 if ( gxvalid->xstatetable.nClasses > 0xFFFFU )
1591
1592 GXV_TRACE(( "StateTable Subtables\n" ));
1593
1594 if ( gxvalid->xstatetable.optdata_load_func )
1595 gxvalid->xstatetable.optdata_load_func( p, limit, gxvalid );
1596
1597 if ( gxvalid->xstatetable.subtable_setup_func )
1598 setup_func = gxvalid->xstatetable.subtable_setup_func;
1599 else
1600 setup_func = gxv_XStateTable_subtable_setup;
1601
1602 setup_func( (FT_ULong)( limit - table ),
1603 classTable,
1604 stateArray,
1605 entryTable,
1606 &classTable_length,
1607 &stateArray_length,
1608 &entryTable_length,
1609 gxvalid );
1610
1611 if ( classTable != 0 )
1612 {
1613 gxvalid->xstatetable.maxClassID = 0;
1617 gxv_LookupTable_validate( table + classTable,
1618 table + classTable + classTable_length,
1619 gxvalid );
1620#if 0
1621 if ( gxvalid->subtable_length < classTable_length )
1622 classTable_length = gxvalid->subtable_length;
1623#endif
1624 }
1625 else
1626 {
1627 /* XXX: check range? */
1628 gxvalid->xstatetable.maxClassID =
1629 (FT_UShort)( gxvalid->xstatetable.nClasses - 1 );
1630 }
1631
1632 if ( stateArray != 0 )
1633 gxv_XStateArray_validate( table + stateArray,
1634 &stateArray_length,
1635 gxvalid->xstatetable.maxClassID,
1636 gxvalid->xstatetable.nClasses,
1637 &maxState,
1638 &maxEntry,
1639 gxvalid );
1640 else
1641 {
1642#if 0
1643 maxState = 1; /* 0:start of text, 1:start of line are predefined */
1644#endif
1645 maxEntry = 0;
1646 }
1647
1648 if ( maxEntry > 0 && entryTable == 0 )
1650
1651 if ( entryTable != 0 )
1652 gxv_XEntryTable_validate( table + entryTable,
1653 &entryTable_length,
1654 maxEntry,
1655 stateArray_length,
1656 gxvalid->xstatetable.maxClassID,
1657 table,
1658 limit,
1659 gxvalid );
1660
1661 GXV_EXIT;
1662 }
#define FT_NEXT_ULONG(buffer)
Definition: ftstream.h:238
static void gxv_XStateArray_validate(FT_Bytes table, FT_ULong *length_p, FT_UShort maxClassID, FT_ULong stateSize, FT_UShort *maxState_p, FT_UShort *maxEntry_p, GXV_Validator gxvalid)
Definition: gxvcommn.c:1403
gxv_LookupTable_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:755
gxv_XStateTable_subtable_setup(FT_ULong table_size, FT_ULong classTable, FT_ULong stateArray, FT_ULong entryTable, FT_ULong *classTable_length_p, FT_ULong *stateArray_length_p, FT_ULong *entryTable_length_p, GXV_Validator gxvalid)
Definition: gxvcommn.c:1312
static GXV_LookupValueDesc gxv_XClassTable_lookupfmt4_transit(FT_UShort relative_gindex, GXV_LookupValueCPtr base_value_p, FT_Bytes lookuptbl_limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:1378
static void gxv_XEntryTable_validate(FT_Bytes table, FT_ULong *length_p, FT_UShort maxEntry, FT_ULong stateArray_length, FT_UShort maxClassID, FT_Bytes xstatetable_table, FT_Bytes xstatetable_limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:1453
static void gxv_XClassTable_lookupval_validate(FT_UShort glyph, GXV_LookupValueCPtr value_p, GXV_Validator gxvalid)
Definition: gxvcommn.c:1338
void(* GXV_XStateTable_Subtable_Setup_Func)(FT_ULong table_size, FT_ULong classTable, FT_ULong stateArray, FT_ULong entryTable, FT_ULong *classTable_length_p, FT_ULong *stateArray_length_p, FT_ULong *entryTable_length_p, GXV_Validator gxvalid)
Definition: gxvcommn.h:198
GXV_XStateTable_ValidatorRec xstatetable
Definition: gxvcommn.h:255
GXV_Lookup_Fmt4_Transit_Func lookupfmt4_trans
Definition: gxvcommn.h:248
GXV_Lookup_Value_Validate_Func lookupval_func
Definition: gxvcommn.h:247
GXV_LookupValue_SignSpec lookupval_sign
Definition: gxvcommn.h:246
GXV_XStateTable_OptData_Load_Func optdata_load_func
Definition: gxvcommn.h:227
GXV_XStateTable_Subtable_Setup_Func subtable_setup_func
Definition: gxvcommn.h:225

Referenced by gxv_morx_subtable_type0_validate(), gxv_morx_subtable_type1_validate(), gxv_morx_subtable_type2_validate(), and gxv_morx_subtable_type5_validate().