OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* ttpload.c */ | 3 /* ttpload.c */ |
4 /* */ | 4 /* */ |
5 /* TrueType-specific tables loader (body). */ | 5 /* TrueType-specific tables loader (body). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 1996-2002, 2004-2011 by */ | 7 /* Copyright 1996-2002, 2004-2012 by */ |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 /* */ | 9 /* */ |
10 /* This file is part of the FreeType project, and may only be used, */ | 10 /* This file is part of the FreeType project, and may only be used, */ |
11 /* modified, and distributed under the terms of the FreeType project */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
15 /* */ | 15 /* */ |
16 /***************************************************************************/ | 16 /***************************************************************************/ |
17 | 17 |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 if ( p + 2 <= p_limit ) | 205 if ( p + 2 <= p_limit ) |
206 pos2 = FT_NEXT_USHORT( p ); | 206 pos2 = FT_NEXT_USHORT( p ); |
207 | 207 |
208 pos1 <<= 1; | 208 pos1 <<= 1; |
209 pos2 <<= 1; | 209 pos2 <<= 1; |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 /* Check broken location data */ | 213 /* Check broken location data */ |
214 if ( pos1 >= face->glyf_len ) | 214 if ( pos1 > face->glyf_len ) |
215 { | 215 { |
216 FT_TRACE1(( "tt_face_get_location:" | 216 FT_TRACE1(( "tt_face_get_location:" |
217 " too large offset=0x%08lx found for gid=0x%04lx," | 217 " too large offset=0x%08lx found for gid=0x%04lx," |
218 " exceeding the end of glyf table (0x%08lx)\n", | 218 " exceeding the end of glyf table (0x%08lx)\n", |
219 pos1, gindex, face->glyf_len )); | 219 pos1, gindex, face->glyf_len )); |
220 *asize = 0; | 220 *asize = 0; |
221 return 0; | 221 return 0; |
222 } | 222 } |
223 | 223 |
224 if ( pos2 >= face->glyf_len ) | 224 if ( pos2 > face->glyf_len ) |
225 { | 225 { |
226 FT_TRACE1(( "tt_face_get_location:" | 226 FT_TRACE1(( "tt_face_get_location:" |
227 " too large offset=0x%08lx found for gid=0x%04lx," | 227 " too large offset=0x%08lx found for gid=0x%04lx," |
228 " truncate at the end of glyf table (0x%08lx)\n", | 228 " truncate at the end of glyf table (0x%08lx)\n", |
229 pos2, gindex + 1, face->glyf_len )); | 229 pos2, gindex + 1, face->glyf_len )); |
230 pos2 = face->glyf_len; | 230 pos2 = face->glyf_len; |
231 } | 231 } |
232 | 232 |
233 /* The `loca' table must be ordered; it refers to the length of */ | 233 /* The `loca' table must be ordered; it refers to the length of */ |
234 /* an entry as the difference between the current and the next */ | 234 /* an entry as the difference between the current and the next */ |
235 /* position. However, there do exist (malformed) fonts which */ | 235 /* position. However, there do exist (malformed) fonts which */ |
236 /* don't obey this rule, so we are only able to provide an */ | 236 /* don't obey this rule, so we are only able to provide an */ |
237 /* upper bound for the size. */ | 237 /* upper bound for the size. */ |
238 /* */ | 238 /* */ |
239 /* We get (intentionally) a wrong, non-zero result in case the */ | 239 /* We get (intentionally) a wrong, non-zero result in case the */ |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 if ( gindex < record_size ) | 590 if ( gindex < record_size ) |
591 result = record + nn * record_size + gindex; | 591 result = record + nn * record_size + gindex; |
592 break; | 592 break; |
593 } | 593 } |
594 | 594 |
595 return result; | 595 return result; |
596 } | 596 } |
597 | 597 |
598 | 598 |
599 /* END */ | 599 /* END */ |
OLD | NEW |