diff options
author | Werner Lemberg <wl@gnu.org> | 2015-09-11 08:28:27 +0200 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2015-09-11 08:28:27 +0200 |
commit | 23423bc6f998fe715306cfc52a436b3f24824f02 (patch) | |
tree | 81e385d1bfaa0abb6b796dec5911513f53dbcb11 /src/type42 | |
parent | b6eef5ae7bc5fd3a07f237c8f609d12dd4084130 (diff) | |
download | freetype2-23423bc6f998fe715306cfc52a436b3f24824f02.tar.gz |
[type42] Fix endless loop (#45920).
* src/type42/t42parse.c (t42_parse_encoding): Synchronize with
type1's `parse_encoding'.
Diffstat (limited to 'src/type42')
-rw-r--r-- | src/type42/t42parse.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c index fadbf21ab..f7d5eb6fa 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 ); } } |