From e9a746674a0bc7483ef2bebdbcb5d84d2aca19e5 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 26 Jun 2006 17:37:44 +0000 Subject: [PATCH] Fix handling of self-delimiting tokens. --- src/psaux/psobjs.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 3c981036d..25b0bc632 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -563,8 +563,8 @@ /* anything else */ while ( cur < limit ) { - /* `*cur' might be invalid (e.g., `)' or `}'), but this is handled */ - /* by the caller which will see this when it continues parsing */ + /* *cur might be invalid (e.g., ')' or '}'), but this */ + /* is handled by the test `cur == parser->cursor' below */ if ( IS_PS_DELIM( *cur ) ) break; @@ -572,6 +572,16 @@ } Exit: + if ( cur == parser->cursor ) + { + FT_ERROR(( "ps_parser_skip_PS_token: " + "current token is `%c', which is self-delimiting " + "but invalid at this point\n", + *cur )); + + error = PSaux_Err_Invalid_File_Format; + } + FT_ASSERT( parser->error == PSaux_Err_Ok ); parser->error = error; parser->cursor = cur;