Skip to content

Commit 8eda9bc

Browse files
authored
Fix the usage of escaped identifiers in scanner_scope_find_let_declaration (#3317)
This patch fixes #3313. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
1 parent 12184d7 commit 8eda9bc

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

jerry-core/parser/js/js-scanner-util.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,8 @@ scanner_scope_find_let_declaration (parser_context_t *context_p, /**< context */
10101010
{
10111011
uint8_t *destination_p = (uint8_t *) scanner_malloc (context_p, literal_p->length);
10121012

1013+
lexer_convert_ident_to_utf8 (literal_p->char_p, destination_p, literal_p->length);
1014+
10131015
name_p = ecma_new_ecma_string_from_utf8 (destination_p, literal_p->length);
10141016
scanner_free (destination_p, literal_p->length);
10151017
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
try {
16+
eval("var" + "\u2029" + 'g\\u0065t: break get' );
17+
assert (false);
18+
} catch (e) {
19+
assert (e instanceof SyntaxError);
20+
}

0 commit comments

Comments
 (0)