Skip to content

Commit 8c30fcd

Browse files
committed
Fix parsing of invalid asterix symbol after private field symbol
Raise syntax error instead of crashing. JerryScript-DCO-1.0-Signed-off-by: Ádám Kulcsár kuladam@inf.u-szeged.hu
1 parent 2dbb6f7 commit 8c30fcd

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

jerry-core/parser/js/js-parser-expr.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,11 @@ parser_parse_class_body (parser_context_t *context_p, /**< context */
687687
context_p->token.flags |= LEXER_NO_SKIP_SPACES;
688688
ident_opts |= LEXER_OBJ_IDENT_CLASS_PRIVATE;
689689
is_private = true;
690+
691+
if (lexer_check_next_character (context_p, LIT_CHAR_ASTERISK))
692+
{
693+
parser_raise_error (context_p, PARSER_ERR_INVALID_CHARACTER);
694+
}
690695
}
691696

692697
if (!lexer_consume_generator (context_p))
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright JS Foundation and other contributors, http://js.foundation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
class C { async #*method() }

tools/cppcheck/suppressions-list

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ shiftNegativeLHS:jerry-math/*.c
3131
shiftTooManyBits:jerry-core/*.c
3232
shiftTooManyBitsSigned:jerry-math/*.c
3333
signConversionCond:jerry-core/*.c
34-
uninitvar:jerry-core/parser/js/js-parser-expr.c:3423
34+
uninitvar:jerry-core/parser/js/js-parser-expr.c:3428
3535
uninitvar:tests/unit-core/test-api-objecttype.c:119
3636
unmatchedSuppression:jerry-core/*.inc.h
3737
unreadVariable:jerry-core/*.c

0 commit comments

Comments
 (0)