Welcome! Log In Create A New Profile

Advanced

[njs] Fixed for(expr1; conditional syntax error handling.

Vadim Zhestikov via nginx-devel
November 18, 2022 05:14PM
details: https://hg.nginx.org/njs/rev/c51adee54dfe
branches:
changeset: 2007:c51adee54dfe
user: Vadim Zhestikov <v.zhestikov@f5.com>
date: Fri Nov 18 14:10:25 2022 -0800
description:
Fixed for(expr1; conditional syntax error handling.

diffstat:

src/njs_parser.c | 4 ++++
src/test/njs_unit_test.c | 3 +++
2 files changed, 7 insertions(+), 0 deletions(-)

diffs (27 lines):

diff -r 8163612eb950 -r c51adee54dfe src/njs_parser.c
--- a/src/njs_parser.c Thu Nov 17 20:38:23 2022 -0800
+++ b/src/njs_parser.c Fri Nov 18 14:10:25 2022 -0800
@@ -5652,6 +5652,10 @@ static njs_int_t
njs_parser_expression_continue_assign_comma(njs_parser_t *parser,
njs_lexer_token_t *token, njs_queue_link_t *current)
{
+ if (parser->ret != NJS_OK) {
+ return njs_parser_failed(parser);
+ }
+
njs_parser_next(parser, njs_parser_assignment_expression_after);

return njs_parser_after(parser, current, NULL, 1,
diff -r 8163612eb950 -r c51adee54dfe src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c Thu Nov 17 20:38:23 2022 -0800
+++ b/src/test/njs_unit_test.c Fri Nov 18 14:10:25 2022 -0800
@@ -2968,6 +2968,9 @@ static njs_unit_test_t njs_test[] =
{ njs_str("for(9A=>>"),
njs_str("SyntaxError: Unexpected token \"A\" in 1") },

+ { njs_str("for(A?{,"),
+ njs_str("SyntaxError: Unexpected token \",\" in 1") },
+
/* switch. */

{ njs_str("switch"),
_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

[njs] Fixed for(expr1; conditional syntax error handling.

Vadim Zhestikov via nginx-devel 259 November 18, 2022 05:14PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 82
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready