Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: src/truetype/ttgload.c

Issue 23555005: Update freetype to the latest version of Android external/freetype (Closed) Base URL: https://chromium.googlesource.com/chromium/src/third_party/freetype.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/truetype/tterrors.h ('k') | src/truetype/ttgxvar.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /***************************************************************************/ 1 /***************************************************************************/
2 /* */ 2 /* */
3 /* ttgload.c */ 3 /* ttgload.c */
4 /* */ 4 /* */
5 /* TrueType Glyph Loader (body). */ 5 /* TrueType Glyph Loader (body). */
6 /* */ 6 /* */
7 /* Copyright 1996-2011 */ 7 /* Copyright 1996-2012 */
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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 goto Fail; 355 goto Fail;
356 356
357 /* reading the contours' endpoints & number of points */ 357 /* reading the contours' endpoints & number of points */
358 cont = gloader->current.outline.contours; 358 cont = gloader->current.outline.contours;
359 cont_limit = cont + n_contours; 359 cont_limit = cont + n_contours;
360 360
361 /* check space for contours array + instructions count */ 361 /* check space for contours array + instructions count */
362 if ( n_contours >= 0xFFF || p + ( n_contours + 1 ) * 2 > limit ) 362 if ( n_contours >= 0xFFF || p + ( n_contours + 1 ) * 2 > limit )
363 goto Invalid_Outline; 363 goto Invalid_Outline;
364 364
365 prev_cont = FT_NEXT_USHORT( p ); 365 prev_cont = FT_NEXT_SHORT( p );
366 366
367 if ( n_contours > 0 ) 367 if ( n_contours > 0 )
368 cont[0] = prev_cont; 368 cont[0] = prev_cont;
369 369
370 if ( prev_cont < 0 )
371 goto Invalid_Outline;
372
370 for ( cont++; cont < cont_limit; cont++ ) 373 for ( cont++; cont < cont_limit; cont++ )
371 { 374 {
372 cont[0] = FT_NEXT_USHORT( p ); 375 cont[0] = FT_NEXT_SHORT( p );
373 if ( cont[0] <= prev_cont ) 376 if ( cont[0] <= prev_cont )
374 { 377 {
375 /* unordered contours: this is invalid */ 378 /* unordered contours: this is invalid */
376 error = TT_Err_Invalid_Table; 379 goto Invalid_Outline;
377 goto Fail;
378 } 380 }
379 prev_cont = cont[0]; 381 prev_cont = cont[0];
380 } 382 }
381 383
382 n_points = 0; 384 n_points = 0;
383 if ( n_contours > 0 ) 385 if ( n_contours > 0 )
384 { 386 {
385 n_points = cont[-1] + 1; 387 n_points = cont[-1] + 1;
386 if ( n_points < 0 ) 388 if ( n_points < 0 )
387 goto Invalid_Outline; 389 goto Invalid_Outline;
388 } 390 }
389 391
390 /* note that we will add four phantom points later */ 392 /* note that we will add four phantom points later */
391 error = FT_GLYPHLOADER_CHECK_POINTS( gloader, n_points + 4, 0 ); 393 error = FT_GLYPHLOADER_CHECK_POINTS( gloader, n_points + 4, 0 );
392 if ( error ) 394 if ( error )
393 goto Fail; 395 goto Fail;
394 396
395 /* we'd better check the contours table right now */
396 outline = &gloader->current.outline;
397
398 for ( cont = outline->contours + 1; cont < cont_limit; cont++ )
399 if ( cont[-1] >= cont[0] )
400 goto Invalid_Outline;
401
402 /* reading the bytecode instructions */ 397 /* reading the bytecode instructions */
403 load->glyph->control_len = 0; 398 load->glyph->control_len = 0;
404 load->glyph->control_data = 0; 399 load->glyph->control_data = 0;
405 400
406 if ( p + 2 > limit ) 401 if ( p + 2 > limit )
407 goto Invalid_Outline; 402 goto Invalid_Outline;
408 403
409 n_ins = FT_NEXT_USHORT( p ); 404 n_ins = FT_NEXT_USHORT( p );
410 405
411 FT_TRACE5(( " Instructions size: %u\n", n_ins )); 406 FT_TRACE5(( " Instructions size: %u\n", n_ins ));
(...skipping 20 matching lines...) Expand all
432 load->glyph->control_len = n_ins; 427 load->glyph->control_len = n_ins;
433 load->glyph->control_data = load->exec->glyphIns; 428 load->glyph->control_data = load->exec->glyphIns;
434 429
435 FT_MEM_COPY( load->exec->glyphIns, p, (FT_Long)n_ins ); 430 FT_MEM_COPY( load->exec->glyphIns, p, (FT_Long)n_ins );
436 } 431 }
437 432
438 #endif /* TT_USE_BYTECODE_INTERPRETER */ 433 #endif /* TT_USE_BYTECODE_INTERPRETER */
439 434
440 p += n_ins; 435 p += n_ins;
441 436
437 outline = &gloader->current.outline;
438
442 /* reading the point tags */ 439 /* reading the point tags */
443 flag = (FT_Byte*)outline->tags; 440 flag = (FT_Byte*)outline->tags;
444 flag_limit = flag + n_points; 441 flag_limit = flag + n_points;
445 442
446 FT_ASSERT( flag != NULL ); 443 FT_ASSERT( flag != NULL );
447 444
448 while ( flag < flag_limit ) 445 while ( flag < flag_limit )
449 { 446 {
450 if ( p + 1 > limit ) 447 if ( p + 1 > limit )
451 goto Invalid_Outline; 448 goto Invalid_Outline;
(...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after
2105 /* */ 2102 /* */
2106 if ( !( load_flags & FT_LOAD_NO_SCALE ) && 2103 if ( !( load_flags & FT_LOAD_NO_SCALE ) &&
2107 size->root.metrics.y_ppem < 24 ) 2104 size->root.metrics.y_ppem < 24 )
2108 glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; 2105 glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
2109 2106
2110 return error; 2107 return error;
2111 } 2108 }
2112 2109
2113 2110
2114 /* END */ 2111 /* END */
OLDNEW
« no previous file with comments | « src/truetype/tterrors.h ('k') | src/truetype/ttgxvar.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698