* include/freetype/fterrdef.h (FT_Err_Corrupted_Font_Header,

FT_Err_Corrupted_Font_Glyphs): New error codes for BDF files.

* src/bdf/bdflib.c (bdf_load_font): Use them.

* src/bdf/bdflib.c (_bdf_parse_start): Check `FONT' better.
This commit is contained in:
Werner Lemberg 2007-06-01 22:16:43 +00:00
parent b9933f4b02
commit 5b591e49cf
3 changed files with 29 additions and 1 deletions

View File

@ -1,3 +1,12 @@
2007-06-02 Werner Lemberg <wl@gnu.org>
* include/freetype/fterrdef.h (FT_Err_Corrupted_Font_Header,
FT_Err_Corrupted_Font_Glyphs): New error codes for BDF files.
* src/bdf/bdflib.c (bdf_load_font): Use them.
* src/bdf/bdflib.c (_bdf_parse_start): Check `FONT' better.
2007-06-01 Werner Lemberg <wl@gnu.org>
* src/base/ftobjs.c (FT_Request_Metrics), src/cache/ftccmap.c

View File

@ -4,7 +4,7 @@
/* */
/* FreeType error codes (specification). */
/* */
/* Copyright 2002, 2004, 2006 by */
/* Copyright 2002, 2004, 2006, 2007 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -230,6 +230,10 @@
"`BBX' field missing" )
FT_ERRORDEF_( Bbx_Too_Big, 0xB7, \
"`BBX' too big" )
FT_ERRORDEF_( Corrupted_Font_Header, 0xB8, \
"Font header corrupted or missing fields" )
FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xB9, \
"Font glyphs corrupted or missing fields" )
/* END */

View File

@ -2123,6 +2123,13 @@
_bdf_list_shift( &p->list, 1 );
s = _bdf_list_join( &p->list, ' ', &slen );
if ( !s )
{
error = BDF_Err_Invalid_File_Format;
goto Exit;
}
if ( FT_NEW_ARRAY( p->font->name, slen + 1 ) )
goto Exit;
FT_MEM_COPY( p->font->name, s, slen + 1 );
@ -2307,11 +2314,19 @@
{
/* The ENDFONT field was never reached or did not exist. */
if ( !( p->flags & _BDF_GLYPHS ) )
{
/* Error happened while parsing header. */
FT_ERROR(( "bdf_load_font: " ERRMSG2, lineno ));
error = BDF_Err_Corrupted_Font_Header;
goto Exit;
}
else
{
/* Error happened when parsing glyphs. */
FT_ERROR(( "bdf_load_font: " ERRMSG3, lineno ));
error = BDF_Err_Corrupted_Font_Glyphs;
goto Exit;
}
}
}