[gxvalid] Fix gcc4.6 compiler warnings in gxvtrak.c. * src/gxvalid/gxvtrak.c (gxv_trak_trackTable_validate): Check different entries pointing same traking value. (gxv_trak_validate): Remove unused variable `table_size'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
diff --git a/ChangeLog b/ChangeLog
index 5a69430..d2cca20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2011-06-14 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+ [gxvalid] Fix gcc4.6 compiler warnings in gxvtrak.c.
+
+ * src/gxvalid/gxvtrak.c (gxv_trak_trackTable_validate):
+ Check different entries pointing same traking value.
+ (gxv_trak_validate): Remove unused variable `table_size'.
+
+2011-06-14 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
[gxvalid] Fix gcc4.6 compiler warnings in gxvmorx*.c.
* src/gxvalid/gxvmorx.c (gxv_morx_subtables_validate):
diff --git a/src/gxvalid/gxvtrak.c b/src/gxvalid/gxvtrak.c
index df3fd15..11fbd7c 100644
--- a/src/gxvalid/gxvtrak.c
+++ b/src/gxvalid/gxvtrak.c
@@ -97,10 +97,10 @@
{
FT_Bytes p = table;
- FT_Fixed track;
+ FT_Fixed track, t;
FT_UShort nameIndex;
FT_UShort offset;
- FT_UShort i;
+ FT_UShort i, j;
GXV_NAME_ENTER( "trackTable" );
@@ -108,9 +108,11 @@
GXV_TRAK_DATA( trackValueOffset_min ) = 0xFFFFU;
GXV_TRAK_DATA( trackValueOffset_max ) = 0x0000;
+ GXV_LIMIT_CHECK( nTracks * ( 4 + 2 + 2 ) );
+
for ( i = 0; i < nTracks; i ++ )
{
- GXV_LIMIT_CHECK( 4 + 2 + 2 );
+ p = table + i * ( 4 + 2 + 2 );
track = FT_NEXT_LONG( p );
nameIndex = FT_NEXT_USHORT( p );
offset = FT_NEXT_USHORT( p );
@@ -121,6 +123,15 @@
GXV_TRAK_DATA( trackValueOffset_max ) = offset;
gxv_sfntName_validate( nameIndex, 256, 32767, valid );
+
+ for ( j = i; j < nTracks; j ++ )
+ {
+ p = table + j * ( 4 + 2 + 2 );
+ t = FT_NEXT_LONG( p );
+ if ( t == track )
+ GXV_TRACE(( "duplicated entries found for track value 0x%x\n",
+ track ));
+ }
}
valid->subtable_length = p - table;
@@ -198,7 +209,6 @@
{
FT_Bytes p = table;
FT_Bytes limit = 0;
- FT_Offset table_size;
GXV_ValidatorRec validrec;
GXV_Validator valid = &validrec;
@@ -220,7 +230,6 @@
valid->face = face;
limit = valid->root->limit;
- table_size = limit - table;
FT_TRACE3(( "validating `trak' table\n" ));
GXV_INIT;