Index: third_party/freetype/src/psaux/psobjs.c |
diff --git a/third_party/freetype/src/psaux/psobjs.c b/third_party/freetype/src/psaux/psobjs.c |
index 7ec3b4cf5fd3a81164adcb57f2af75f30f3ebefc..1d3c7e662cefdb2286024b91efb478ed90722c4e 100644 |
--- a/third_party/freetype/src/psaux/psobjs.c |
+++ b/third_party/freetype/src/psaux/psobjs.c |
@@ -4,7 +4,7 @@ |
/* */ |
/* Auxiliary functions for PostScript fonts (body). */ |
/* */ |
-/* Copyright 1996-2014 by */ |
+/* Copyright 1996-2015 by */ |
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
/* */ |
/* This file is part of the FreeType project, and may only be used, */ |
@@ -81,7 +81,7 @@ |
table->max_elems = count; |
table->init = 0xDEADBEEFUL; |
table->num_elems = 0; |
- table->block = 0; |
+ table->block = NULL; |
table->capacity = 0; |
table->cursor = 0; |
@@ -165,10 +165,10 @@ |
/* reallocation fails. */ |
/* */ |
FT_LOCAL_DEF( FT_Error ) |
- ps_table_add( PS_Table table, |
- FT_Int idx, |
- void* object, |
- FT_PtrDist length ) |
+ ps_table_add( PS_Table table, |
+ FT_Int idx, |
+ void* object, |
+ FT_UInt length ) |
{ |
if ( idx < 0 || idx >= table->max_elems ) |
{ |
@@ -176,12 +176,6 @@ |
return FT_THROW( Invalid_Argument ); |
} |
- if ( length < 0 ) |
- { |
- FT_ERROR(( "ps_table_add: invalid length\n" )); |
- return FT_THROW( Invalid_Argument ); |
- } |
- |
/* grow the base block if needed */ |
if ( table->cursor + length > table->capacity ) |
{ |
@@ -600,6 +594,9 @@ |
error = FT_THROW( Invalid_File_Format ); |
} |
+ if ( cur > limit ) |
+ cur = limit; |
+ |
parser->error = error; |
parser->cursor = cur; |
} |
@@ -625,8 +622,8 @@ |
token->type = T1_TOKEN_TYPE_NONE; |
- token->start = 0; |
- token->limit = 0; |
+ token->start = NULL; |
+ token->limit = NULL; |
/* first of all, skip leading whitespace */ |
ps_parser_skip_spaces( parser ); |
@@ -707,7 +704,7 @@ |
if ( !token->limit ) |
{ |
- token->start = 0; |
+ token->start = NULL; |
token->type = T1_TOKEN_TYPE_NONE; |
} |
@@ -932,7 +929,7 @@ |
FT_Memory memory ) |
{ |
FT_Byte* cur = *cursor; |
- FT_PtrDist len = 0; |
+ FT_UInt len = 0; |
FT_Int count; |
FT_String* result; |
FT_Error error; |
@@ -972,7 +969,7 @@ |
} |
} |
- len = cur - *cursor; |
+ len = (FT_UInt)( cur - *cursor ); |
if ( cur >= limit || FT_ALLOC( result, len + 1 ) ) |
return 0; |
@@ -1230,20 +1227,22 @@ |
for ( i = 0; i < 4; i++ ) |
{ |
- result = ps_tofixedarray( &cur, limit, max_objects, |
+ result = ps_tofixedarray( &cur, limit, (FT_Int)max_objects, |
temp + i * max_objects, 0 ); |
if ( result < 0 || (FT_UInt)result < max_objects ) |
{ |
FT_ERROR(( "ps_parser_load_field:" |
- " expected %d integers in the %s subarray\n" |
+ " expected %d integer%s in the %s subarray\n" |
" " |
" of /FontBBox in the /Blend dictionary\n", |
- max_objects, |
+ max_objects, max_objects > 1 ? "s" : "", |
i == 0 ? "first" |
: ( i == 1 ? "second" |
: ( i == 2 ? "third" |
: "fourth" ) ) )); |
error = FT_THROW( Invalid_File_Format ); |
+ |
+ FT_FREE( temp ); |
goto Exit; |
} |
@@ -1321,7 +1320,7 @@ |
goto Exit; |
} |
if ( (FT_UInt)num_elements > field->array_max ) |
- num_elements = field->array_max; |
+ num_elements = (FT_Int)field->array_max; |
old_cursor = parser->cursor; |
old_limit = parser->limit; |
@@ -1379,7 +1378,7 @@ |
ps_parser_to_bytes( PS_Parser parser, |
FT_Byte* bytes, |
FT_Offset max_bytes, |
- FT_Long* pnum_bytes, |
+ FT_ULong* pnum_bytes, |
FT_Bool delimiters ) |
{ |
FT_Error error = FT_Err_Ok; |
@@ -1553,7 +1552,7 @@ |
FT_GlyphLoader_Rewind( loader ); |
builder->hints_globals = size->internal; |
- builder->hints_funcs = 0; |
+ builder->hints_funcs = NULL; |
if ( hinting ) |
builder->hints_funcs = glyph->internal->glyph_hints; |