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

Side by Side Diff: third_party/freetype/src/base/ftmac.c

Issue 1413673003: Update bundled freetype to 2.6.1 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: DEPS for corpus Created 5 years, 1 month 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 | « third_party/freetype/src/base/ftlcdfil.c ('k') | third_party/freetype/src/base/ftmm.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 /* ftmac.c */ 3 /* ftmac.c */
4 /* */ 4 /* */
5 /* Mac FOND support. Written by just@letterror.com. */ 5 /* Mac FOND support. Written by just@letterror.com. */
6 /* Heavily modified by mpsuzuki, George Williams, and Sean McBride. */ 6 /* Heavily modified by mpsuzuki, George Williams, and Sean McBride. */
7 /* */ 7 /* */
8 /* This file is for Mac OS X only; see builds/mac/ftoldmac.c for */ 8 /* This file is for Mac OS X only; see builds/mac/ftoldmac.c for */
9 /* classic platforms built by MPW. */ 9 /* classic platforms built by MPW. */
10 /* */ 10 /* */
11 /* Copyright 1996-2009, 2013, 2014 by */ 11 /* Copyright 1996-2015 by */
12 /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ 12 /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */
13 /* */ 13 /* */
14 /* This file is part of the FreeType project, and may only be used, */ 14 /* This file is part of the FreeType project, and may only be used, */
15 /* modified, and distributed under the terms of the FreeType project */ 15 /* modified, and distributed under the terms of the FreeType project */
16 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 16 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
17 /* this file you indicate that you have read the license and */ 17 /* this file you indicate that you have read the license and */
18 /* understand and accept it fully. */ 18 /* understand and accept it fully. */
19 /* */ 19 /* */
20 /***************************************************************************/ 20 /***************************************************************************/
21 21
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 code = (*post_data)[0]; 611 code = (*post_data)[0];
612 612
613 if ( code != last_code ) 613 if ( code != last_code )
614 { 614 {
615 if ( code == 5 ) 615 if ( code == 5 )
616 total_size += 2; /* just the end code */ 616 total_size += 2; /* just the end code */
617 else 617 else
618 total_size += 6; /* code + 4 bytes chunk length */ 618 total_size += 6; /* code + 4 bytes chunk length */
619 } 619 }
620 620
621 total_size += GetHandleSize( post_data ) - 2; 621 total_size += (FT_ULong)GetHandleSize( post_data ) - 2;
622 last_code = code; 622 last_code = code;
623 623
624 /* detect integer overflows */ 624 /* detect resource fork overflow */
625 if ( total_size < old_total_size ) 625 if ( FT_MAC_RFORK_MAX_LEN < total_size )
626 { 626 {
627 error = FT_THROW( Array_Too_Large ); 627 error = FT_THROW( Array_Too_Large );
628 goto Error; 628 goto Error;
629 } 629 }
630 630
631 old_total_size = total_size; 631 old_total_size = total_size;
632 } 632 }
633 633
634 if ( FT_ALLOC( buffer, (FT_Long)total_size ) ) 634 if ( FT_ALLOC( buffer, (FT_Long)total_size ) )
635 goto Error; 635 goto Error;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 FT_Error error = FT_Err_Ok; 740 FT_Error error = FT_Err_Ok;
741 FT_Memory memory = library->memory; 741 FT_Memory memory = library->memory;
742 int is_cff, is_sfnt_ps; 742 int is_cff, is_sfnt_ps;
743 743
744 744
745 sfnt = GetResource( TTAG_sfnt, sfnt_id ); 745 sfnt = GetResource( TTAG_sfnt, sfnt_id );
746 if ( sfnt == NULL ) 746 if ( sfnt == NULL )
747 return FT_THROW( Invalid_Handle ); 747 return FT_THROW( Invalid_Handle );
748 748
749 sfnt_size = (FT_ULong)GetHandleSize( sfnt ); 749 sfnt_size = (FT_ULong)GetHandleSize( sfnt );
750
751 /* detect resource fork overflow */
752 if ( FT_MAC_RFORK_MAX_LEN < sfnt_size )
753 return FT_THROW( Array_Too_Large );
754
750 if ( FT_ALLOC( sfnt_data, (FT_Long)sfnt_size ) ) 755 if ( FT_ALLOC( sfnt_data, (FT_Long)sfnt_size ) )
751 { 756 {
752 ReleaseResource( sfnt ); 757 ReleaseResource( sfnt );
753 return error; 758 return error;
754 } 759 }
755 760
756 ft_memcpy( sfnt_data, *sfnt, sfnt_size ); 761 ft_memcpy( sfnt_data, *sfnt, sfnt_size );
757 ReleaseResource( sfnt ); 762 ReleaseResource( sfnt );
758 763
759 is_cff = sfnt_size > 4 && !ft_memcmp( sfnt_data, "OTTO", 4 ); 764 is_cff = sfnt_size > 4 && !ft_memcmp( sfnt_data, "OTTO", 4 );
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 return FT_THROW( Invalid_Argument ); 1071 return FT_THROW( Invalid_Argument );
1067 else 1072 else
1068 return FT_New_Face_From_FSRef( library, &ref, face_index, aface ); 1073 return FT_New_Face_From_FSRef( library, &ref, face_index, aface );
1069 #endif 1074 #endif
1070 } 1075 }
1071 1076
1072 #endif /* FT_MACINTOSH */ 1077 #endif /* FT_MACINTOSH */
1073 1078
1074 1079
1075 /* END */ 1080 /* END */
OLDNEW
« no previous file with comments | « third_party/freetype/src/base/ftlcdfil.c ('k') | third_party/freetype/src/base/ftmm.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698