summaryrefslogtreecommitdiff
path: root/src/bdf
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2007-06-01 22:16:43 +0000
committerWerner Lemberg <wl@gnu.org>2007-06-01 22:16:43 +0000
commit5b591e49cf3c87fddeb44acc8a6b6d3a4fbda31a (patch)
treea24dfac3ca197008b5a4cfedadc18b94373b2fdd /src/bdf
parentb9933f4b028dc64a6f59569d7ba8b747398b7602 (diff)
* 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.
Diffstat (limited to 'src/bdf')
-rw-r--r--src/bdf/bdflib.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index 8dade71b..512cd62c 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -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;
+ }
}
}