shithub: freetype+ttf2subf

Download patch

ref: 4086fb7caf41e33137e548e43a49a97b127cd369
parent: 5dddcc45a03b336860436a180aec5b358517336b
author: Werner Lemberg <[email protected]>
date: Thu Mar 1 03:55:40 EST 2012

[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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2012-02-29  Werner Lemberg  <[email protected]>
 
+	[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  <[email protected]>
+
 	[truetype] Fix Savannah bug #35640.
 
 	* src/truetype/ttinterp.c (SkipCode, TT_RunIns): Fix boundary check
--- 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 ) )