/[freetype]/freetype2/src/gxvalid/gxvopbd.c
ViewVC logotype

Diff of /freetype2/src/gxvalid/gxvopbd.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by mpsuzuki, Wed Aug 24 04:31:31 2005 UTC revision 1.2 by wl, Mon Sep 5 19:31:27 2005 UTC
# Line 15  Line 15 
15  /*                                                                         */  /*                                                                         */
16  /***************************************************************************/  /***************************************************************************/
17    
18    /***************************************************************************/
19    /*                                                                         */
20    /* gxvalid is derived from both gxlayout module and otvalid module.        */
21    /* Development of gxlayout is supported by the Information-technology      */
22    /* Promotion Agency(IPA), Japan.                                           */
23    /*                                                                         */
24    /***************************************************************************/
25    
26    
27  #include "gxvalid.h"  #include "gxvalid.h"
28  #include "gxvcommn.h"  #include "gxvcommn.h"
29    
# Line 29  Line 38 
38  #define FT_COMPONENT  trace_gxvopbd  #define FT_COMPONENT  trace_gxvopbd
39    
40    
   
41    /*************************************************************************/    /*************************************************************************/
42    /*************************************************************************/    /*************************************************************************/
43    /*****                                                               *****/    /*****                                                               *****/
# Line 45  Line 53 
53    
54    } GXV_opbd_DataRec, *GXV_opbd_Data;    } GXV_opbd_DataRec, *GXV_opbd_Data;
55    
56  #define  GXV_OPBD_DATA(FIELD)  GXV_TABLE_DATA( opbd, FIELD )  
57    #define GXV_OPBD_DATA( FIELD )  GXV_TABLE_DATA( opbd, FIELD )
58    
59    
60    /*************************************************************************/    /*************************************************************************/
# Line 71  Line 80 
80      if ( value.u < GXV_OPBD_DATA( valueOffset_min ) )      if ( value.u < GXV_OPBD_DATA( valueOffset_min ) )
81        GXV_OPBD_DATA( valueOffset_min ) = value.u;        GXV_OPBD_DATA( valueOffset_min ) = value.u;
82    
   
83      for ( i = 0; i < 4; i++ )      for ( i = 0; i < 4; i++ )
84      {      {
85        GXV_LIMIT_CHECK( 2 );        GXV_LIMIT_CHECK( 2 );
86        delta_value = FT_NEXT_SHORT( p );        delta_value = FT_NEXT_SHORT( p );
87    
88        if ( GXV_OPBD_DATA( format ) ) /* format 1, value is ctrl pt. */        if ( GXV_OPBD_DATA( format ) )    /* format 1, value is ctrl pt. */
89        {        {
90          if ( delta_value == -1 )          if ( delta_value == -1 )
91            continue;            continue;
92    
93          gxv_ctlPoint_validate( glyph, delta_value, valid );          gxv_ctlPoint_validate( glyph, delta_value, valid );
94        }        }
95        else /* format 0, value is distance */        else                              /* format 0, value is distance */
96          continue;          continue;
97      }      }
98    }    }
# Line 130  Line 138 
138    {    {
139      GXV_LookupValueDesc  value;      GXV_LookupValueDesc  value;
140    
141        FT_UNUSED( lookuptbl_limit );
142        FT_UNUSED( valid );
143    
144    
145      value.u = base_value.u + ( relative_gindex * 4 * sizeof ( FT_Short ) );      value.u = base_value.u + relative_gindex * 4 * sizeof ( FT_Short );
146    
147      return value;      return value;
148    }    }
149    
150    
151    /*************************************************************************/    /*************************************************************************/
152    /*************************************************************************/    /*************************************************************************/
153    /*****                                                               *****/    /*****                                                               *****/
# Line 163  Line 175 
175      valid->table_data = opbd;      valid->table_data = opbd;
176      valid->face       = face;      valid->face       = face;
177    
178      FT_TRACE3(( "validation opbd table\n" ));      FT_TRACE3(( "validating `opbd' table\n" ));
179      GXV_INIT;      GXV_INIT;
180      GXV_OPBD_DATA( valueOffset_min ) = 0xFFFF;      GXV_OPBD_DATA( valueOffset_min ) = 0xFFFFU;
181    
182    
183      GXV_LIMIT_CHECK( 4 + 2 );      GXV_LIMIT_CHECK( 4 + 2 );
# Line 173  Line 185 
185      GXV_OPBD_DATA( format ) = FT_NEXT_USHORT( p );      GXV_OPBD_DATA( format ) = FT_NEXT_USHORT( p );
186    
187    
188      /* 0x00010000 is only defined (1996) */      /* only 0x00010000 is defined (1996) */
189      GXV_TRACE(( "(version=0x%08x)\n", version ));      GXV_TRACE(( "(version=0x%08x)\n", version ));
190      if ( 0x00010000UL != version )      if ( 0x00010000UL != version )
191        FT_INVALID_FORMAT;        FT_INVALID_FORMAT;
192    
193      /* 0, 1 are only defined (1996) */      /* only values 0 and 1 are defined (1996) */
194      GXV_TRACE(( "(format=0x%04x)\n", GXV_OPBD_DATA( format ) ));      GXV_TRACE(( "(format=0x%04x)\n", GXV_OPBD_DATA( format ) ));
195      if ( 0x0001 < GXV_OPBD_DATA( format ) )      if ( 0x0001 < GXV_OPBD_DATA( format ) )
196        FT_INVALID_FORMAT;        FT_INVALID_FORMAT;
197    
   
198      valid->lookupval_sign   = GXV_LOOKUPVALUE_UNSIGNED;      valid->lookupval_sign   = GXV_LOOKUPVALUE_UNSIGNED;
199      valid->lookupval_func   = gxv_opbd_LookupValue_validate;      valid->lookupval_func   = gxv_opbd_LookupValue_validate;
200      valid->lookupfmt4_trans = gxv_opbd_LookupFmt4_transit;      valid->lookupfmt4_trans = gxv_opbd_LookupFmt4_transit;
201    
202      gxv_LookupTable_validate( p, limit, valid );      gxv_LookupTable_validate( p, limit, valid );
203      p += valid->subtable_length;      p += valid->subtable_length;
204    
   
205      if ( p > table + GXV_OPBD_DATA( valueOffset_min ) )      if ( p > table + GXV_OPBD_DATA( valueOffset_min ) )
206      {      {
207        GXV_TRACE(( "found overlap between LookupTable and opbd_value array\n" ));        GXV_TRACE((
208            "found overlap between LookupTable and opbd_value array\n" ));
209        FT_INVALID_OFFSET;        FT_INVALID_OFFSET;
210      }      }
211    
   
212      FT_TRACE4(( "\n" ));      FT_TRACE4(( "\n" ));
213    }    }
214    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26