[bdf] Fix Savannah bug #35641. * src/bdf/bdflib.c (_bdf_parse_glyphs) <DWIDTH, BBX>: Abort if _BDF_ENCODING isn't set. We need this because access to the `glyph' variable might be undefined otherwise.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
diff --git a/ChangeLog b/ChangeLog
index 75deee3..41830b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2012-02-29 Werner Lemberg <wl@gnu.org>
+ [bdf] Fix Savannah bug #35641.
+
+ * src/bdf/bdflib.c (_bdf_parse_glyphs) <DWIDTH, BBX>: Abort if
+ _BDF_ENCODING isn't set. We need this because access to the `glyph'
+ variable might be undefined otherwise.
+
+2012-02-29 Werner Lemberg <wl@gnu.org>
+
[truetype] Fix Savannah bug #35640.
* src/truetype/ttinterp.c (SkipCode, TT_RunIns): Fix boundary check
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index 8a5ffce..5a718cb 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -1779,12 +1779,7 @@
if ( ft_memcmp( line, "SWIDTH", 6 ) == 0 )
{
if ( !( p->flags & _BDF_ENCODING ) )
- {
- /* Missing ENCODING field. */
- FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENCODING" ));
- error = BDF_Err_Missing_Encoding_Field;
- goto Exit;
- }
+ goto Missing_Encoding;
error = _bdf_list_split( &p->list, (char *)" +", line, linelen );
if ( error )
@@ -1799,6 +1794,9 @@
/* Expect the DWIDTH (scalable width) field next. */
if ( ft_memcmp( line, "DWIDTH", 6 ) == 0 )
{
+ if ( !( p->flags & _BDF_ENCODING ) )
+ goto Missing_Encoding;
+
error = _bdf_list_split( &p->list, (char *)" +", line, linelen );
if ( error )
goto Exit;
@@ -1824,6 +1822,9 @@
/* Expect the BBX field next. */
if ( ft_memcmp( line, "BBX", 3 ) == 0 )
{
+ if ( !( p->flags & _BDF_ENCODING ) )
+ goto Missing_Encoding;
+
error = _bdf_list_split( &p->list, (char *)" +", line, linelen );
if ( error )
goto Exit;
@@ -1924,6 +1925,12 @@
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG9, lineno ));
error = BDF_Err_Invalid_File_Format;
+ goto Exit;
+
+ Missing_Encoding:
+ /* Missing ENCODING field. */
+ FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENCODING" ));
+ error = BDF_Err_Missing_Encoding_Field;
Exit:
if ( error && ( p->flags & _BDF_GLYPH ) )