Commit f28c95c4a40842795fb159bff56b5be9fee867cd

Werner Lemberg 2015-09-17T19:30:26

[type42] Fix memory leak (#45989). * src/type42/t42parse.c (t42_parse_charstrings): Allow only a single `CharStrings' array.

diff --git a/ChangeLog b/ChangeLog
index 6e90f76..511c8cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2015-09-17  Werner Lemberg  <wl@gnu.org>
 
+	[type42] Fix memory leak (#45989).
+
+	* src/type42/t42parse.c (t42_parse_charstrings): Allow only a single
+	`CharStrings' array.
+
+2015-09-17  Werner Lemberg  <wl@gnu.org>
+
 	[psaux] Fix memory leak (#45986).
 
 	* src/psaux/psobjs.c (ps_parser_load_field) <T1_FIELD_TYPE_MM_BBOX>:
diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
index ee77d86..003b63e 100644
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -841,6 +841,15 @@
 
     /* initialize tables */
 
+    /* contrary to Type1, we disallow multiple CharStrings arrays */
+    if ( swap_table->init )
+    {
+      FT_ERROR(( "t42_parse_charstrings:"
+                 " only one CharStrings array allowed\n" ));
+      error = FT_THROW( Invalid_File_Format );
+      goto Fail;
+    }
+
     error = psaux->ps_table_funcs->init( code_table,
                                          loader->num_glyphs,
                                          memory );