Legacy octal escapes should not be allowed in template strings (#4227)

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
This commit is contained in:
Dániel Bátyai
2020-09-25 10:14:28 +02:00
committed by GitHub
parent 43e03a1ac6
commit 629a0e51c4
5 changed files with 16 additions and 2 deletions
+7
View File
@@ -1083,6 +1083,13 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
* converted to a character which has the same byte length. */
if (*source_p >= LIT_CHAR_0 && *source_p <= LIT_CHAR_3)
{
#if ENABLED (JERRY_ESNEXT)
if (str_end_character == LIT_CHAR_GRAVE_ACCENT)
{
parser_raise_error (context_p, PARSER_ERR_TEMPLATE_STR_OCTAL_ESCAPE);
}
#endif
if (context_p->status_flags & PARSER_IS_STRICT)
{
parser_raise_error (context_p, PARSER_ERR_OCTAL_ESCAPE_NOT_ALLOWED);