Jacek Caban : jscript: Improved error handling in numeric literal parser.
Module: wine Branch: stable Commit: 8dcce6d50ada148ef65af0420bfd2fd2d275c014 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8dcce6d50ada148ef65af0420b... Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Nov 6 17:18:38 2013 +0100 jscript: Improved error handling in numeric literal parser. (cherry picked from commit 1a89ea7043e2ea10ff4a29c1c15f45ec80f3dbd7) --- dlls/jscript/lex.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/jscript/lex.c b/dlls/jscript/lex.c index d6a0ba1..844ae91 100644 --- a/dlls/jscript/lex.c +++ b/dlls/jscript/lex.c @@ -456,6 +456,11 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li else exp += e; } + if(is_identifier_char(*ctx->ptr)) { + WARN("wrong char after zero\n"); + return lex_error(ctx, JS_E_MISSING_SEMICOLON); + } + *literal = new_double_literal(ctx, exp>=0 ? d*pow(10, exp) : d/pow(10, -exp)); return tNumericLiteral; } @@ -479,7 +484,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal) if(ctx->ptr < ctx->end && is_identifier_char(*ctx->ptr)) { WARN("unexpected identifier char\n"); - return lex_error(ctx, E_FAIL); + return lex_error(ctx, JS_E_MISSING_SEMICOLON); } *literal = new_double_literal(ctx, l); @@ -514,9 +519,8 @@ static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal) if(is_identifier_char(*ctx->ptr)) { WARN("wrong char after zero\n"); - return lex_error(ctx, E_FAIL); + return lex_error(ctx, JS_E_MISSING_SEMICOLON); } - } return parse_double_literal(ctx, l, literal);
participants (1)
-
Alexandre Julliard