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

Unified Diff: third_party/freetype/src/type1/t1load.c

Issue 815103002: Update freetype to 2.5.4. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Adjust GYP and GN Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/freetype/src/type1/t1load.h ('k') | third_party/freetype/src/type1/t1objs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/freetype/src/type1/t1load.c
diff --git a/core/src/fxge/fx_freetype/fxft2.5.01/src/type1/t1load.c b/third_party/freetype/src/type1/t1load.c
similarity index 98%
rename from core/src/fxge/fx_freetype/fxft2.5.01/src/type1/t1load.c
rename to third_party/freetype/src/type1/t1load.c
index 661dd075ebce8efb2fb46df5c68ba93624a0af4d..22b3f6b31ddc40587c7952484d08678c6317454a 100644
--- a/core/src/fxge/fx_freetype/fxft2.5.01/src/type1/t1load.c
+++ b/third_party/freetype/src/type1/t1load.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 font loader (body). */
/* */
-/* Copyright 1996-2013 by */
+/* Copyright 1996-2014 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -60,12 +60,12 @@
/*************************************************************************/
-#include "../../include/ft2build.h"
-#include "../../include/freetype/internal/ftdebug.h"
-#include "../../include/freetype/config/ftconfig.h"
-#include "../../include/freetype/ftmm.h"
-#include "../../include/freetype/internal/t1types.h"
-#include "../../include/freetype/internal/ftcalc.h"
+#include <ft2build.h>
+#include FT_INTERNAL_DEBUG_H
+#include FT_CONFIG_CONFIG_H
+#include FT_MULTIPLE_MASTERS_H
+#include FT_INTERNAL_TYPE1_TYPES_H
+#include FT_INTERNAL_CALC_H
#include "t1load.h"
#include "t1errors.h"
@@ -377,8 +377,6 @@
if ( blend && blend->num_axis == num_coords )
{
/* recompute the weight vector from the blend coordinates */
- error = FT_Err_Ok;
-
for ( n = 0; n < blend->num_designs; n++ )
{
FT_Fixed result = 0x10000L; /* 1.0 fixed */
@@ -1100,14 +1098,14 @@
FT_Matrix* matrix = &face->type1.font_matrix;
FT_Vector* offset = &face->type1.font_offset;
FT_Face root = (FT_Face)&face->root;
- FT_Fixed temp[6] = {0, 0, 0, 0, 0, 0};
- FT_Fixed temp_scale = 0;
+ FT_Fixed temp[6];
+ FT_Fixed temp_scale;
FT_Int result;
result = T1_ToFixedArray( parser, 6, temp, 3 );
- if ( result < 0 )
+ if ( result < 6 )
{
parser->root.error = FT_THROW( Invalid_File_Format );
return;
@@ -1213,7 +1211,7 @@
char* notdef = (char *)".notdef";
- T1_Add_Table( char_table, n, notdef, 8 );
+ (void)T1_Add_Table( char_table, n, notdef, 8 );
}
/* Now we need to read records of the form */
@@ -1274,6 +1272,13 @@
{
charcode = (FT_Int)T1_ToInt( parser );
T1_Skip_Spaces( parser );
+
+ /* protect against invalid charcode */
+ if ( cur == parser->root.cursor )
+ {
+ parser->root.error = FT_THROW( Unknown_File_Format );
+ return;
+ }
}
cur = parser->root.cursor;
@@ -1591,6 +1596,11 @@
}
T1_Skip_PS_Token( parser );
+ if ( parser->root.cursor >= limit )
+ {
+ error = FT_THROW( Invalid_File_Format );
+ goto Fail;
+ }
if ( parser->root.error )
return;
@@ -1599,7 +1609,7 @@
FT_PtrDist len;
- if ( cur + 1 >= limit )
+ if ( cur + 2 >= limit )
{
error = FT_THROW( Invalid_File_Format );
goto Fail;
@@ -1610,12 +1620,7 @@
if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) )
return;
- /* xhl: Add boundary check here. Fix the bug reported by ifilter. */
- /* TESTDOC: bug# 0018509, 45.pdf. */
- if (base + size >= limit) {
- error = T1_Err_Invalid_File_Format;
- goto Fail;
- }
+
/* for some non-standard fonts like `Optima' which provides */
/* different outlines depending on the resolution it is */
/* possible to get here twice */
@@ -2214,7 +2219,6 @@
if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY )
{
FT_Int charcode, idx, min_char, max_char;
- FT_Byte* char_name;
FT_Byte* glyph_name;
@@ -2229,6 +2233,9 @@
charcode = 0;
for ( ; charcode < loader.encoding_table.max_elems; charcode++ )
{
+ FT_Byte* char_name;
+
+
type1->encoding.char_index[charcode] = 0;
type1->encoding.char_name [charcode] = (char *)".notdef";
« no previous file with comments | « third_party/freetype/src/type1/t1load.h ('k') | third_party/freetype/src/type1/t1objs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698