[type42] Fix endless loop (#45920). * src/type42/t42parse.c (t42_parse_encoding): Synchronize with type1's `parse_encoding'.
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
diff --git a/ChangeLog b/ChangeLog
index 73a7a41..804a7b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-09-11 Werner Lemberg <wl@gnu.org>
+
+ [type42] Fix endless loop (#45920).
+
+ * src/type42/t42parse.c (t42_parse_encoding): Synchronize with
+ type1's `parse_encoding'.
+
2015-09-10 Werner Lemberg <wl@gnu.org>
[docmaker] Allow `-' in bold and italic markup.
diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
index fadbf21..f7d5eb6 100644
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -414,6 +414,13 @@
{
charcode = (FT_Int)T1_ToInt( parser );
T1_Skip_Spaces( parser );
+
+ /* protect against invalid charcode */
+ if ( cur == parser->root.cursor )
+ {
+ parser->root.error = FT_THROW( Unknown_File_Format );
+ return;
+ }
}
cur = parser->root.cursor;
@@ -448,10 +455,10 @@
/* immediates-only mode we would get an infinite loop if */
/* we don't do anything here. */
/* */
- /* This encoding array is not valid according to the type1 */
- /* specification (it might be an encoding for a CID type1 */
- /* font, however), so we conclude that this font is NOT a */
- /* type1 font. */
+ /* This encoding array is not valid according to the */
+ /* type42 specification (it might be an encoding for a CID */
+ /* type42 font, however), so we conclude that this font is */
+ /* NOT a type42 font. */
parser->root.error = FT_THROW( Unknown_File_Format );
return;
}
@@ -487,7 +494,7 @@
face->type1.encoding_type = T1_ENCODING_TYPE_ISOLATIN1;
else
- parser->root.error = FT_THROW( Ignore );
+ parser->root.error = FT_ERR( Ignore );
}
}