Commit 8dc17bb47b205f08bd3020ed93793d04db02627a

Werner Lemberg 2012-05-07T11:24:48

[type1] Fix Savannah bug #36386. * src/type1/t1load.c (t1_load_keyword): Ignore keyword if context is not valid.

diff --git a/ChangeLog b/ChangeLog
index e6e1002..96dba1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-05-07  Werner Lemberg  <wl@gnu.org>
+
+	[type1] Fix Savannah bug #36386.
+
+	* src/type1/t1load.c (t1_load_keyword): Ignore keyword if context is
+	not valid.
+
 2012-04-07  Werner Lemberg  <wl@gnu.org>
 
 	Remove compiler warning.
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index 5803fde..7313fef 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -1011,13 +1011,24 @@
       max_objects  = 0;
     }
 
-    if ( field->type == T1_FIELD_TYPE_INTEGER_ARRAY ||
-         field->type == T1_FIELD_TYPE_FIXED_ARRAY   )
-      error = T1_Load_Field_Table( &loader->parser, field,
-                                   objects, max_objects, 0 );
+    if ( *objects )
+    {
+      if ( field->type == T1_FIELD_TYPE_INTEGER_ARRAY ||
+           field->type == T1_FIELD_TYPE_FIXED_ARRAY   )
+        error = T1_Load_Field_Table( &loader->parser, field,
+                                     objects, max_objects, 0 );
+      else
+        error = T1_Load_Field( &loader->parser, field,
+                               objects, max_objects, 0 );
+    }
     else
-      error = T1_Load_Field( &loader->parser, field,
-                             objects, max_objects, 0 );
+    {
+      FT_TRACE1(( "t1_load_keyword: ignoring keyword `%s'"
+                  " which is not valid at this point\n"
+                  "                 (probably due to missing keywords)\n",
+                 field->ident ));
+      error = T1_Err_Ok;
+    }
 
   Exit:
     return error;
@@ -1970,8 +1981,8 @@
 
               if ( !( dict & keyword->dict ) )
               {
-                FT_TRACE1(( "parse_dict: found %s but ignoring it "
-                            "since it is in the wrong dictionary\n",
+                FT_TRACE1(( "parse_dict: found `%s' but ignoring it"
+                            " since it is in the wrong dictionary\n",
                             keyword->ident ));
                 break;
               }