summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--src/autofit/afloader.c4
-rw-r--r--src/base/ftobjs.c11
-rw-r--r--src/base/ftoutln.c2
-rw-r--r--src/cff/cffgload.c13
-rw-r--r--src/psaux/psobjs.c10
-rw-r--r--src/psaux/t1decode.c12
-rw-r--r--src/truetype/ttgload.c39
-rw-r--r--src/truetype/ttgxvar.c6
-rw-r--r--src/truetype/ttobjs.c8
10 files changed, 80 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index 97cfa4882..4b846bacc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
2014-11-24 Werner Lemberg <wl@gnu.org>
+ [Savannah bug #43682] Properly handle missing return errors.
+
+ The functions in this patch *do* return non-trivial errors that must
+ be taken care of.
+
+ * src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c
+ (FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render),
+ src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>,
+ src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode
+ (t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c
+ (load_truetype_glyph <subglyph loop>, tt_loader_init,
+ TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
+ src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
+
+2014-11-24 Werner Lemberg <wl@gnu.org>
+
[Savannah bug #43682] Add/remove `void' casts to some functions.
We use a cast to indicate that we intentionally ignore a function's
diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c
index 0fa3c1278..b8a88f1a5 100644
--- a/src/autofit/afloader.c
+++ b/src/autofit/afloader.c
@@ -131,8 +131,8 @@
loader->trans_delta = internal->glyph_delta;
inverse = loader->trans_matrix;
- FT_Matrix_Invert( &inverse );
- FT_Vector_Transform( &loader->trans_delta, &inverse );
+ if ( !FT_Matrix_Invert( &inverse ) )
+ FT_Vector_Transform( &loader->trans_delta, &inverse );
}
switch ( slot->format )
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 977ac01a4..3c107e407 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -3747,11 +3747,11 @@
FT_Face face;
- if ( size == NULL )
+ if ( !size )
return FT_THROW( Invalid_Argument );
face = size->face;
- if ( face == NULL || face->driver == NULL )
+ if ( !face || !face->driver )
return FT_THROW( Invalid_Argument );
/* we don't need anything more complex than that; all size objects */
@@ -4037,7 +4037,11 @@
/* if we changed the current renderer for the glyph image format */
/* we need to select it as the next current one */
if ( !error && update && renderer )
- FT_Set_Renderer( library, renderer, 0, 0 );
+ {
+ error = FT_Set_Renderer( library, renderer, 0, 0 );
+ if ( error )
+ break;
+ }
}
}
@@ -4047,6 +4051,7 @@
#define FT_COMPONENT trace_bitmap
/* we convert to a single bitmap format for computing the checksum */
+ if ( !error )
{
FT_Bitmap bitmap;
FT_Error err;
diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c
index 632b6d237..0ed561edb 100644
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -643,7 +643,7 @@
/* if we changed the current renderer for the glyph image format */
/* we need to select it as the next current one */
if ( !error && update && renderer )
- FT_Set_Renderer( library, renderer, 0, 0 );
+ error = FT_Set_Renderer( library, renderer, 0, 0 );
return error;
}
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 89f927303..577375da6 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -1989,9 +1989,6 @@
}
else
{
- if ( !error )
- error = FT_Err_Ok;
-
cff_builder_close_contour( builder );
/* close hints recording session */
@@ -2002,10 +1999,12 @@
goto Syntax_Error;
/* apply hints to the loaded glyph outline now */
- hinter->apply( hinter->hints,
- builder->current,
- (PSH_Globals)builder->hints_globals,
- decoder->hint_mode );
+ error = hinter->apply( hinter->hints,
+ builder->current,
+ (PSH_Globals)builder->hints_globals,
+ decoder->hint_mode );
+ if ( error )
+ goto Fail;
}
/* add current outline to the glyph slot */
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
index b4b7d45c3..7ec3b4cf5 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -1338,7 +1338,15 @@
{
parser->cursor = token->start;
parser->limit = token->limit;
- ps_parser_load_field( parser, &fieldrec, objects, max_objects, 0 );
+
+ error = ps_parser_load_field( parser,
+ &fieldrec,
+ objects,
+ max_objects,
+ 0 );
+ if ( error )
+ break;
+
fieldrec.offset += fieldrec.size;
}
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
index 6ce370bfa..d67a05ebc 100644
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -4,7 +4,7 @@
/* */
/* PostScript Type 1 decoding routines (body). */
/* */
-/* Copyright 2000-2013 by */
+/* Copyright 2000-2014 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -1098,10 +1098,12 @@
goto Syntax_Error;
/* apply hints to the loaded glyph outline now */
- hinter->apply( hinter->hints,
- builder->current,
- (PSH_Globals)builder->hints_globals,
- decoder->hint_mode );
+ error = hinter->apply( hinter->hints,
+ builder->current,
+ (PSH_Globals)builder->hints_globals,
+ decoder->hint_mode );
+ if ( error )
+ goto Fail;
}
/* add current outline to the glyph slot */
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index c15fabd62..c5841c301 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1787,8 +1787,12 @@
/* (1): exists from the beginning */
/* (2): components that have been loaded so far */
/* (3): the newly loaded component */
- TT_Process_Composite_Component( loader, subglyph, start_point,
- num_base_points );
+ error = TT_Process_Composite_Component( loader,
+ subglyph,
+ start_point,
+ num_base_points );
+ if ( error )
+ goto Exit;
}
loader->stream = old_stream;
@@ -1797,16 +1801,17 @@
/* process the glyph */
loader->ins_pos = ins_pos;
if ( IS_HINTED( loader->load_flags ) &&
-
#ifdef TT_USE_BYTECODE_INTERPRETER
-
subglyph->flags & WE_HAVE_INSTR &&
-
#endif
-
num_points > start_point )
- TT_Process_Composite_Glyph( loader, start_point, start_contour );
-
+ {
+ error = TT_Process_Composite_Glyph( loader,
+ start_point,
+ start_contour );
+ if ( error )
+ goto Exit;
+ }
}
}
else
@@ -2081,6 +2086,8 @@
FT_Int32 load_flags,
FT_Bool glyf_table_only )
{
+ FT_Error error;
+
TT_Face face;
FT_Stream stream;
#ifdef TT_USE_BYTECODE_INTERPRETER
@@ -2120,9 +2127,7 @@
if ( size->bytecode_ready < 0 || size->cvt_ready < 0 )
{
- FT_Error error = tt_size_ready_bytecode( size, pedantic );
-
-
+ error = tt_size_ready_bytecode( size, pedantic );
if ( error )
return error;
}
@@ -2193,7 +2198,9 @@
FT_RENDER_MODE_MONO );
}
- TT_Load_Context( exec, face, size );
+ error = TT_Load_Context( exec, face, size );
+ if ( error )
+ return error;
#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
@@ -2240,8 +2247,7 @@
if ( reexecute )
{
- FT_UInt i;
- FT_Error error;
+ FT_UInt i;
for ( i = 0; i < size->cvt_size; i++ )
@@ -2279,8 +2285,7 @@
#endif
{
- FT_Error error = face->goto_table( face, TTAG_glyf, stream, 0 );
-
+ error = face->goto_table( face, TTAG_glyf, stream, 0 );
if ( FT_ERR_EQ( error, Table_Missing ) )
loader->glyf_offset = 0;
@@ -2462,7 +2467,7 @@
#endif /* TT_USE_BYTECODE_INTERPRETER */
- compute_glyph_metrics( &loader, glyph_index );
+ error = compute_glyph_metrics( &loader, glyph_index );
}
/* Set the `high precision' bit flag. */
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 7899d3671..1b35539fe 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -4,7 +4,7 @@
/* */
/* TrueType GX Font Variation loader */
/* */
-/* Copyright 2004-2013 by */
+/* Copyright 2004-2014 by */
/* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -938,13 +938,13 @@
FT_FREE( face->cvt );
face->cvt = NULL;
- tt_face_load_cvt( face, face->root.stream );
+ error = tt_face_load_cvt( face, face->root.stream );
break;
case mcvt_modify:
/* The original cvt table is in memory. All we need to do is */
/* apply the `cvar' table (if any). */
- tt_face_vary_cvt( face, face->root.stream );
+ error = tt_face_vary_cvt( face, face->root.stream );
break;
case mcvt_retain:
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index 5da171e72..a73529d84 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -760,7 +760,9 @@
if ( !exec )
return FT_THROW( Could_Not_Find_Context );
- TT_Load_Context( exec, face, size );
+ error = TT_Load_Context( exec, face, size );
+ if ( error )
+ return error;
exec->callTop = 0;
exec->top = 0;
@@ -852,7 +854,9 @@
if ( !exec )
return FT_THROW( Could_Not_Find_Context );
- TT_Load_Context( exec, face, size );
+ error = TT_Load_Context( exec, face, size );
+ if ( error )
+ return error;
exec->callTop = 0;
exec->top = 0;