Index: third_party/freetype/src/cid/cidload.c |
diff --git a/core/src/fxge/fx_freetype/fxft2.5.01/src/cid/cidload.c b/third_party/freetype/src/cid/cidload.c |
similarity index 96% |
rename from core/src/fxge/fx_freetype/fxft2.5.01/src/cid/cidload.c |
rename to third_party/freetype/src/cid/cidload.c |
index bfb25dc37d1375ac19c9ad288d52ec11fbee11b9..1cda0eee7ada422ada94e842586420c084fcf3e8 100644 |
--- a/core/src/fxge/fx_freetype/fxft2.5.01/src/cid/cidload.c |
+++ b/third_party/freetype/src/cid/cidload.c |
@@ -4,7 +4,7 @@ |
/* */ |
/* CID-keyed Type1 font loader (body). */ |
/* */ |
-/* Copyright 1996-2006, 2009, 2011-2013 by */ |
+/* Copyright 1996-2006, 2009, 2011-2014 by */ |
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
/* */ |
/* This file is part of the FreeType project, and may only be used, */ |
@@ -16,11 +16,11 @@ |
/***************************************************************************/ |
-#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 <ft2build.h> |
+#include FT_INTERNAL_DEBUG_H |
+#include FT_CONFIG_CONFIG_H |
+#include FT_MULTIPLE_MASTERS_H |
+#include FT_INTERNAL_TYPE1_TYPES_H |
#include "cidload.h" |
@@ -150,8 +150,6 @@ |
cid_parse_font_matrix( CID_Face face, |
CID_Parser* parser ) |
{ |
- FT_Matrix* matrix; |
- FT_Vector* offset; |
CID_FaceDict dict; |
FT_Face root = (FT_Face)&face->root; |
FT_Fixed temp[6]; |
@@ -160,14 +158,28 @@ |
if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts ) |
{ |
+ FT_Matrix* matrix; |
+ FT_Vector* offset; |
+ FT_Int result; |
+ |
+ |
dict = face->cid.font_dicts + parser->num_dict; |
matrix = &dict->font_matrix; |
offset = &dict->font_offset; |
- (void)cid_parser_to_fixed_array( parser, 6, temp, 3 ); |
+ result = cid_parser_to_fixed_array( parser, 6, temp, 3 ); |
+ |
+ if ( result < 6 ) |
+ return FT_THROW( Invalid_File_Format ); |
temp_scale = FT_ABS( temp[3] ); |
+ if ( temp_scale == 0 ) |
+ { |
+ FT_ERROR(( "cid_parse_font_matrix: invalid font matrix\n" )); |
+ return FT_THROW( Invalid_File_Format ); |
+ } |
+ |
/* Set Units per EM based on FontMatrix values. We set the value to */ |
/* 1000 / temp_scale, because temp_scale was already multiplied by */ |
/* 1000 (in t1_tofixed, from psobjs.c). */ |
@@ -182,7 +194,7 @@ |
temp[2] = FT_DivFix( temp[2], temp_scale ); |
temp[4] = FT_DivFix( temp[4], temp_scale ); |
temp[5] = FT_DivFix( temp[5], temp_scale ); |
- temp[3] = 0x10000L; |
+ temp[3] = temp[3] < 0 ? -0x10000L : 0x10000L; |
} |
matrix->xx = temp[0]; |
@@ -195,8 +207,7 @@ |
offset->y = temp[5] >> 16; |
} |
- return FT_Err_Ok; /* this is a callback function; */ |
- /* we must return an error code */ |
+ return FT_Err_Ok; |
} |