* src/truetype/ttobjs.c (tt_face_done), src/cff/cffobjs.c

(cff_face_done), src/pfr/pfrobjs.c (pfr_face_done),
src/pcf/pcfdrivr.c (PCF_Face_Done), src/cid/cidobjs.c
(cid_face_done), src/bdf/bdfdrivr. (BDF_Face_Done),
src/sfnt/sfobjs.c (sfnt_face_done): Protect against face == 0.
Reported by Graham Asher.
This commit is contained in:
Werner Lemberg 2008-10-01 22:39:05 +00:00
parent 6bc16e92e4
commit d03d856d95
11 changed files with 192 additions and 145 deletions

View File

@ -1,3 +1,12 @@
2008-10-01 Werner Lemberg <wl@gnu.org>
* src/truetype/ttobjs.c (tt_face_done), src/cff/cffobjs.c
(cff_face_done), src/pfr/pfrobjs.c (pfr_face_done),
src/pcf/pcfdrivr.c (PCF_Face_Done), src/cid/cidobjs.c
(cid_face_done), src/bdf/bdfdrivr. (BDF_Face_Done),
src/sfnt/sfobjs.c (sfnt_face_done): Protect against face == 0.
Reported by Graham Asher.
2008-09-30 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> 2008-09-30 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* src/base/rules.mk: Add conditional source to BASE_SRC, for `make * src/base/rules.mk: Add conditional source to BASE_SRC, for `make

View File

@ -305,9 +305,14 @@ THE SOFTWARE.
BDF_Face_Done( FT_Face bdfface ) /* BDF_Face */ BDF_Face_Done( FT_Face bdfface ) /* BDF_Face */
{ {
BDF_Face face = (BDF_Face)bdfface; BDF_Face face = (BDF_Face)bdfface;
FT_Memory memory = FT_FACE_MEMORY( face ); FT_Memory memory;
if ( !face )
return;
memory = FT_FACE_MEMORY( face );
bdf_free_font( face->bdffont ); bdf_free_font( face->bdffont );
FT_FREE( face->en_table ); FT_FREE( face->en_table );

View File

@ -920,10 +920,16 @@
cff_face_done( FT_Face cffface ) /* CFF_Face */ cff_face_done( FT_Face cffface ) /* CFF_Face */
{ {
CFF_Face face = (CFF_Face)cffface; CFF_Face face = (CFF_Face)cffface;
FT_Memory memory = cffface->memory; FT_Memory memory;
SFNT_Service sfnt = (SFNT_Service)face->sfnt; SFNT_Service sfnt;
if ( !face )
return;
memory = cffface->memory;
sfnt = (SFNT_Service)face->sfnt;
if ( sfnt ) if ( sfnt )
sfnt->done_face( face ); sfnt->done_face( face );

View File

@ -4,7 +4,7 @@
/* */ /* */
/* CID objects manager (body). */ /* CID objects manager (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -195,14 +195,15 @@
{ {
CID_Face face = (CID_Face)cidface; CID_Face face = (CID_Face)cidface;
FT_Memory memory; FT_Memory memory;
CID_FaceInfo cid;
PS_FontInfo info;
if ( face ) if ( !face )
{ return;
CID_FaceInfo cid = &face->cid;
PS_FontInfo info = &cid->font_info;
cid = &face->cid;
info = &cid->font_info;
memory = cidface->memory; memory = cidface->memory;
/* release subrs */ /* release subrs */
@ -248,7 +249,6 @@
FT_FREE( face->binary_data ); FT_FREE( face->binary_data );
FT_FREE( face->cid_stream ); FT_FREE( face->cid_stream );
} }
}
/*************************************************************************/ /*************************************************************************/

View File

@ -197,9 +197,14 @@ THE SOFTWARE.
PCF_Face_Done( FT_Face pcfface ) /* PCF_Face */ PCF_Face_Done( FT_Face pcfface ) /* PCF_Face */
{ {
PCF_Face face = (PCF_Face)pcfface; PCF_Face face = (PCF_Face)pcfface;
FT_Memory memory = FT_FACE_MEMORY( face ); FT_Memory memory;
if ( !face )
return;
memory = FT_FACE_MEMORY( face );
FT_FREE( face->encodings ); FT_FREE( face->encodings );
FT_FREE( face->metrics ); FT_FREE( face->metrics );

View File

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType PFR object methods (body). */ /* FreeType PFR object methods (body). */
/* */ /* */
/* Copyright 2002, 2003, 2004, 2005, 2006, 2007 by */ /* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -42,9 +42,14 @@
pfr_face_done( FT_Face pfrface ) /* PFR_Face */ pfr_face_done( FT_Face pfrface ) /* PFR_Face */
{ {
PFR_Face face = (PFR_Face)pfrface; PFR_Face face = (PFR_Face)pfrface;
FT_Memory memory = pfrface->driver->root.memory; FT_Memory memory;
if ( !face )
return;
memory = pfrface->driver->root.memory;
/* we don't want dangling pointers */ /* we don't want dangling pointers */
pfrface->family_name = NULL; pfrface->family_name = NULL;
pfrface->style_name = NULL; pfrface->style_name = NULL;

View File

@ -1027,10 +1027,16 @@
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
sfnt_done_face( TT_Face face ) sfnt_done_face( TT_Face face )
{ {
FT_Memory memory = face->root.memory; FT_Memory memory;
SFNT_Service sfnt = (SFNT_Service)face->sfnt; SFNT_Service sfnt;
if ( !face )
return;
memory = face->root.memory;
sfnt = (SFNT_Service)face->sfnt;
if ( sfnt ) if ( sfnt )
{ {
/* destroy the postscript names table if it is loaded */ /* destroy the postscript names table if it is loaded */

View File

@ -4,7 +4,7 @@
/* */ /* */
/* Objects manager (body). */ /* Objects manager (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -331,11 +331,17 @@
tt_face_done( FT_Face ttface ) /* TT_Face */ tt_face_done( FT_Face ttface ) /* TT_Face */
{ {
TT_Face face = (TT_Face)ttface; TT_Face face = (TT_Face)ttface;
FT_Memory memory = face->root.memory; FT_Memory memory;
FT_Stream stream = face->root.stream; FT_Stream stream;
SFNT_Service sfnt;
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
if ( !face )
return;
memory = face->root.memory;
stream = face->root.stream;
sfnt = (SFNT_Service)face->sfnt;
/* for `extended TrueType formats' (i.e. compressed versions) */ /* for `extended TrueType formats' (i.e. compressed versions) */
if ( face->extra.finalizer ) if ( face->extra.finalizer )

View File

@ -191,12 +191,16 @@
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
T1_Face_Done( T1_Face face ) T1_Face_Done( T1_Face face )
{ {
if ( face ) FT_Memory memory;
{ T1_Font type1;
FT_Memory memory = face->root.memory;
T1_Font type1 = &face->type1;
if ( !face )
return;
memory = face->root.memory;
type1 = &face->type1;
#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
/* release multiple masters information */ /* release multiple masters information */
FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) ); FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );
@ -257,7 +261,6 @@
face->root.family_name = NULL; face->root.family_name = NULL;
face->root.style_name = NULL; face->root.style_name = NULL;
} }
}
/*************************************************************************/ /*************************************************************************/

View File

@ -392,8 +392,9 @@
FT_Memory memory; FT_Memory memory;
if ( face ) if ( !face )
{ return;
type1 = &face->type1; type1 = &face->type1;
info = &type1->font_info; info = &type1->font_info;
memory = face->root.memory; memory = face->root.memory;
@ -436,7 +437,6 @@
face->root.family_name = 0; face->root.family_name = 0;
face->root.style_name = 0; face->root.style_name = 0;
} }
}
/*************************************************************************/ /*************************************************************************/

View File

@ -665,17 +665,19 @@
static void static void
FNT_Face_Done( FNT_Face face ) FNT_Face_Done( FNT_Face face )
{ {
if ( face ) FT_Memory memory;
{
FT_Memory memory = FT_FACE_MEMORY( face );
if ( !face )
return;
memory = FT_FACE_MEMORY( face );
fnt_font_done( face ); fnt_font_done( face );
FT_FREE( face->root.available_sizes ); FT_FREE( face->root.available_sizes );
face->root.num_fixed_sizes = 0; face->root.num_fixed_sizes = 0;
} }
}
static FT_Error static FT_Error