ReactOS  0.4.15-dev-2701-g34593d9
gxvfeat.c File Reference
#include "gxvalid.h"
#include "gxvcommn.h"
#include "gxvfeat.h"
Include dependency graph for gxvfeat.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GXV_feat_DataRec_
 

Macros

#define FT_COMPONENT   trace_gxvfeat
 
#define GXV_FEAT_DATA(field)   GXV_TABLE_DATA( feat, field )
 

Typedefs

typedef struct GXV_feat_DataRec_ GXV_feat_DataRec
 
typedef struct GXV_feat_DataRec_GXV_feat_Data
 
typedef enum GXV_FeatureFlagsMask_ GXV_FeatureFlagsMask
 

Enumerations

enum  GXV_FeatureFlagsMask_ { GXV_FEAT_MASK_EXCLUSIVE_SETTINGS = 0x8000U, GXV_FEAT_MASK_DYNAMIC_DEFAULT = 0x4000, GXV_FEAT_MASK_UNUSED = 0x3F00, GXV_FEAT_MASK_DEFAULT_SETTING = 0x00FF }
 

Functions

static void gxv_feat_registry_validate (FT_UShort feature, FT_UShort nSettings, FT_Bool exclusive, GXV_Validator gxvalid)
 
static void gxv_feat_name_index_validate (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
static void gxv_feat_setting_validate (FT_Bytes table, FT_Bytes limit, FT_Bool exclusive, GXV_Validator gxvalid)
 
static void gxv_feat_name_validate (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
 gxv_feat_validate (FT_Bytes table, FT_Face face, FT_Validator ftvalid)
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   trace_gxvfeat

Definition at line 40 of file gxvfeat.c.

◆ GXV_FEAT_DATA

#define GXV_FEAT_DATA (   field)    GXV_TABLE_DATA( feat, field )

Definition at line 60 of file gxvfeat.c.

Typedef Documentation

◆ GXV_feat_Data

◆ GXV_feat_DataRec

◆ GXV_FeatureFlagsMask

Enumeration Type Documentation

◆ GXV_FeatureFlagsMask_

Enumerator
GXV_FEAT_MASK_EXCLUSIVE_SETTINGS 
GXV_FEAT_MASK_DYNAMIC_DEFAULT 
GXV_FEAT_MASK_UNUSED 
GXV_FEAT_MASK_DEFAULT_SETTING 

Definition at line 63 of file gxvfeat.c.

Function Documentation

◆ gxv_feat_name_index_validate()

static void gxv_feat_name_index_validate ( FT_Bytes  table,
FT_Bytes  limit,
GXV_Validator  gxvalid 
)
static

Definition at line 138 of file gxvfeat.c.

141  {
142  FT_Bytes p = table;
143 
144  FT_Short nameIndex;
145 
146 
147  GXV_NAME_ENTER( "nameIndex" );
148 
149  GXV_LIMIT_CHECK( 2 );
150  nameIndex = FT_NEXT_SHORT ( p );
151  GXV_TRACE(( " (nameIndex = %d)\n", nameIndex ));
152 
153  gxv_sfntName_validate( (FT_UShort)nameIndex,
154  255,
155  32768U,
156  gxvalid );
157 
158  GXV_EXIT;
159  }
#define GXV_NAME_ENTER(name)
Definition: gxvcommn.h:301
#define GXV_TRACE(s)
Definition: gxvcommn.h:304
#define U(x)
Definition: wordpad.c:45
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
gxv_sfntName_validate(FT_UShort name_index, FT_UShort min_index, FT_UShort max_index, GXV_Validator gxvalid)
Definition: gxvcommn.c:884
#define GXV_EXIT
Definition: gxvcommn.h:302
const FT_Byte * FT_Bytes
Definition: fttypes.h:165
signed short FT_Short
Definition: fttypes.h:198
#define FT_NEXT_SHORT(buffer)
Definition: ftstream.h:223
GLfloat GLfloat p
Definition: glext.h:8902
unsigned short FT_UShort
Definition: fttypes.h:209
#define GXV_LIMIT_CHECK(_count)
Definition: gxvcommn.h:272

Referenced by gxv_feat_name_validate(), and gxv_feat_setting_validate().

◆ gxv_feat_name_validate()

static void gxv_feat_name_validate ( FT_Bytes  table,
FT_Bytes  limit,
GXV_Validator  gxvalid 
)
static

Definition at line 191 of file gxvfeat.c.

194  {
195  FT_Bytes p = table;
196  FT_UInt reserved_size = GXV_FEAT_DATA( reserved_size );
197 
199  FT_UShort nSettings;
200  FT_ULong settingTable;
201  FT_UShort featureFlags;
202 
203  FT_Bool exclusive;
204  FT_Int last_setting;
205  FT_UInt i;
206 
207 
208  GXV_NAME_ENTER( "name" );
209 
210  /* feature + nSettings + settingTable + featureFlags */
211  GXV_LIMIT_CHECK( 2 + 2 + 4 + 2 );
212 
213  feature = FT_NEXT_USHORT( p );
215 
216  nSettings = FT_NEXT_USHORT( p );
217  settingTable = FT_NEXT_ULONG ( p );
218  featureFlags = FT_NEXT_USHORT( p );
219 
220  if ( settingTable < reserved_size )
222 
223  if ( ( featureFlags & GXV_FEAT_MASK_UNUSED ) == 0 )
225 
226  exclusive = FT_BOOL( featureFlags & GXV_FEAT_MASK_EXCLUSIVE_SETTINGS );
227  if ( exclusive )
228  {
229  FT_Byte dynamic_default;
230 
231 
232  if ( featureFlags & GXV_FEAT_MASK_DYNAMIC_DEFAULT )
233  dynamic_default = (FT_Byte)( featureFlags &
235  else
236  dynamic_default = 0;
237 
238  /* If exclusive, check whether default setting is in the range. */
239  if ( !( dynamic_default < nSettings ) )
241  }
242 
243  gxv_feat_registry_validate( feature, nSettings, exclusive, gxvalid );
244 
245  gxv_feat_name_index_validate( p, limit, gxvalid );
246 
247  p = gxvalid->root->base + settingTable;
248  for ( last_setting = -1, i = 0; i < nSettings; i++ )
249  {
250  gxv_feat_setting_validate( p, limit, exclusive, gxvalid );
251 
252  if ( (FT_Int)GXV_FEAT_DATA( setting ) <= last_setting )
254 
255  last_setting = (FT_Int)GXV_FEAT_DATA( setting );
256  /* setting + nameIndex */
257  p += ( 2 + 2 );
258  }
259 
260  GXV_EXIT;
261  }
INTERNETFEATURELIST feature
Definition: misc.c:1719
unsigned long FT_ULong
Definition: fttypes.h:253
#define FT_INVALID_FORMAT
Definition: ftvalid.h:142
#define GXV_NAME_ENTER(name)
Definition: gxvcommn.h:301
signed int FT_Int
Definition: fttypes.h:220
static void gxv_feat_name_index_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvfeat.c:138
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
static void gxv_feat_setting_validate(FT_Bytes table, FT_Bytes limit, FT_Bool exclusive, GXV_Validator gxvalid)
Definition: gxvfeat.c:163
GLint limit
Definition: glext.h:10326
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
#define GXV_SET_ERR_IF_PARANOID(err)
Definition: gxvcommn.h:66
unsigned char FT_Byte
Definition: fttypes.h:154
#define GXV_FEAT_DATA(field)
Definition: gxvfeat.c:60
#define GXV_EXIT
Definition: gxvcommn.h:302
FT_Validator root
Definition: gxvcommn.h:239
const FT_Byte * FT_Bytes
Definition: fttypes.h:165
static void gxv_feat_registry_validate(FT_UShort feature, FT_UShort nSettings, FT_Bool exclusive, GXV_Validator gxvalid)
Definition: gxvfeat.c:82
#define FT_BOOL(x)
Definition: fttypes.h:578
#define FT_NEXT_USHORT(buffer)
Definition: ftstream.h:226
#define FT_INVALID_OFFSET
Definition: ftvalid.h:138
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
unsigned int FT_UInt
Definition: fttypes.h:231
#define FT_NEXT_ULONG(buffer)
Definition: ftstream.h:238
#define FT_INVALID_DATA
Definition: ftvalid.h:150
GLfloat GLfloat p
Definition: glext.h:8902
unsigned short FT_UShort
Definition: fttypes.h:209
#define GXV_LIMIT_CHECK(_count)
Definition: gxvcommn.h:272

Referenced by gxv_feat_validate().

◆ gxv_feat_registry_validate()

static void gxv_feat_registry_validate ( FT_UShort  feature,
FT_UShort  nSettings,
FT_Bool  exclusive,
GXV_Validator  gxvalid 
)
static

Definition at line 82 of file gxvfeat.c.

86  {
87  GXV_NAME_ENTER( "feature in registry" );
88 
89  GXV_TRACE(( " (feature = %u)\n", feature ));
90 
92  {
93  GXV_TRACE(( "feature number %d is out of range %d\n",
96  goto Exit;
97  }
98 
99  if ( gxv_feat_registry[feature].existence == 0 )
100  {
101  GXV_TRACE(( "feature number %d is in defined range but doesn't exist\n",
102  feature ));
104  goto Exit;
105  }
106 
107  if ( gxv_feat_registry[feature].apple_reserved )
108  {
109  /* Don't use here. Apple is reserved. */
110  GXV_TRACE(( "feature number %d is reserved by Apple\n", feature ));
111  if ( gxvalid->root->level >= FT_VALIDATE_TIGHT )
113  }
114 
115  if ( nSettings != gxv_feat_registry[feature].nSettings )
116  {
117  GXV_TRACE(( "feature %d: nSettings %d != defined nSettings %d\n",
118  feature, nSettings,
119  gxv_feat_registry[feature].nSettings ));
120  if ( gxvalid->root->level >= FT_VALIDATE_TIGHT )
122  }
123 
124  if ( exclusive != gxv_feat_registry[feature].exclusive )
125  {
126  GXV_TRACE(( "exclusive flag %d differs from predefined value\n",
127  exclusive ));
128  if ( gxvalid->root->level >= FT_VALIDATE_TIGHT )
130  }
131 
132  Exit:
133  GXV_EXIT;
134  }
INTERNETFEATURELIST feature
Definition: misc.c:1719
#define GXV_NAME_ENTER(name)
Definition: gxvcommn.h:301
#define GXV_TRACE(s)
Definition: gxvcommn.h:304
#define gxv_feat_registry_length
Definition: gxvfeat.h:55
#define GXV_SET_ERR_IF_PARANOID(err)
Definition: gxvcommn.h:66
static GX_Feature_RegistryRec gxv_feat_registry[]
Definition: gxvfeat.h:60
#define GXV_EXIT
Definition: gxvcommn.h:302
FT_Validator root
Definition: gxvcommn.h:239
static void Exit(void)
Definition: sock.c:1331
#define FT_INVALID_DATA
Definition: ftvalid.h:150

Referenced by gxv_feat_name_validate().

◆ gxv_feat_setting_validate()

static void gxv_feat_setting_validate ( FT_Bytes  table,
FT_Bytes  limit,
FT_Bool  exclusive,
GXV_Validator  gxvalid 
)
static

Definition at line 163 of file gxvfeat.c.

167  {
168  FT_Bytes p = table;
170 
171 
172  GXV_NAME_ENTER( "setting" );
173 
174  GXV_LIMIT_CHECK( 2 );
175 
176  setting = FT_NEXT_USHORT( p );
177 
178  /* If we have exclusive setting, the setting should be odd. */
179  if ( exclusive && ( setting & 1 ) == 0 )
181 
182  gxv_feat_name_index_validate( p, limit, gxvalid );
183 
185 
186  GXV_EXIT;
187  }
#define GXV_NAME_ENTER(name)
Definition: gxvcommn.h:301
static void gxv_feat_name_index_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvfeat.c:138
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
GLint limit
Definition: glext.h:10326
#define GXV_FEAT_DATA(field)
Definition: gxvfeat.c:60
#define GXV_EXIT
Definition: gxvcommn.h:302
const FT_Byte * FT_Bytes
Definition: fttypes.h:165
#define FT_NEXT_USHORT(buffer)
Definition: ftstream.h:226
#define FT_INVALID_DATA
Definition: ftvalid.h:150
GLfloat GLfloat p
Definition: glext.h:8902
unsigned short FT_UShort
Definition: fttypes.h:209
#define GXV_LIMIT_CHECK(_count)
Definition: gxvcommn.h:272

Referenced by gxv_feat_name_validate().

◆ gxv_feat_validate()

gxv_feat_validate ( FT_Bytes  table,
FT_Face  face,
FT_Validator  ftvalid 
)

Definition at line 273 of file gxvfeat.c.

276  {
277  GXV_ValidatorRec gxvalidrec;
278  GXV_Validator gxvalid = &gxvalidrec;
279 
280  GXV_feat_DataRec featrec;
281  GXV_feat_Data feat = &featrec;
282 
283  FT_Bytes p = table;
284  FT_Bytes limit = 0;
285 
286  FT_UInt featureNameCount;
287 
288  FT_UInt i;
289  FT_Int last_feature;
290 
291 
292  gxvalid->root = ftvalid;
293  gxvalid->table_data = feat;
294  gxvalid->face = face;
295 
296  FT_TRACE3(( "validating `feat' table\n" ));
297  GXV_INIT;
298 
299  feat->reserved_size = 0;
300 
301  /* version + featureNameCount + none_0 + none_1 */
302  GXV_LIMIT_CHECK( 4 + 2 + 2 + 4 );
303  feat->reserved_size += 4 + 2 + 2 + 4;
304 
305  if ( FT_NEXT_ULONG( p ) != 0x00010000UL ) /* Version */
307 
308  featureNameCount = FT_NEXT_USHORT( p );
309  GXV_TRACE(( " (featureNameCount = %d)\n", featureNameCount ));
310 
311  if ( !( IS_PARANOID_VALIDATION ) )
312  p += 6; /* skip (none) and (none) */
313  else
314  {
315  if ( FT_NEXT_USHORT( p ) != 0 )
317 
318  if ( FT_NEXT_ULONG( p ) != 0 )
320  }
321 
322  feat->reserved_size += featureNameCount * ( 2 + 2 + 4 + 2 + 2 );
323 
324  for ( last_feature = -1, i = 0; i < featureNameCount; i++ )
325  {
326  gxv_feat_name_validate( p, limit, gxvalid );
327 
328  if ( (FT_Int)GXV_FEAT_DATA( feature ) <= last_feature )
330 
331  last_feature = GXV_FEAT_DATA( feature );
332  p += 2 + 2 + 4 + 2 + 2;
333  }
334 
335  FT_TRACE4(( "\n" ));
336  }
INTERNETFEATURELIST feature
Definition: misc.c:1719
#define FT_INVALID_FORMAT
Definition: ftvalid.h:142
signed int FT_Int
Definition: fttypes.h:220
#define GXV_TRACE(s)
Definition: gxvcommn.h:304
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
GLint limit
Definition: glext.h:10326
#define GXV_SET_ERR_IF_PARANOID(err)
Definition: gxvcommn.h:66
#define FT_TRACE4(varformat)
Definition: ftdebug.h:161
void * table_data
Definition: gxvcommn.h:242
#define GXV_FEAT_DATA(field)
Definition: gxvfeat.c:60
FT_Validator root
Definition: gxvcommn.h:239
WORD face[3]
Definition: mesh.c:4747
const FT_Byte * FT_Bytes
Definition: fttypes.h:165
FT_UInt reserved_size
Definition: gxvfeat.c:53
#define FT_NEXT_USHORT(buffer)
Definition: ftstream.h:226
static void gxv_feat_name_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvfeat.c:191
#define FT_TRACE3(varformat)
Definition: ftdebug.h:160
#define IS_PARANOID_VALIDATION
Definition: gxvcommn.h:65
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
unsigned int FT_UInt
Definition: fttypes.h:231
#define FT_NEXT_ULONG(buffer)
Definition: ftstream.h:238
#define FT_INVALID_DATA
Definition: ftvalid.h:150
GLfloat GLfloat p
Definition: glext.h:8902
#define GXV_INIT
Definition: gxvcommn.h:300
#define GXV_LIMIT_CHECK(_count)
Definition: gxvcommn.h:272