Fix null escape in character classes (#3192)
Fixes #3001. JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
This commit is contained in:
committed by
Robert Fancsik
parent
5ed8647b9e
commit
21e17a1412
@@ -452,8 +452,7 @@ re_parse_char_class (re_compiler_ctx_t *re_ctx_p, /**< number of classes */
|
|||||||
re_append_char_class (re_ctx_p, LIT_CHAR_LOWERCASE_Z + 1, LIT_UTF16_CODE_UNIT_MAX);
|
re_append_char_class (re_ctx_p, LIT_CHAR_LOWERCASE_Z + 1, LIT_UTF16_CODE_UNIT_MAX);
|
||||||
ch = LIT_CHAR_UNDEF;
|
ch = LIT_CHAR_UNDEF;
|
||||||
}
|
}
|
||||||
else if (lit_char_is_octal_digit ((ecma_char_t) ch)
|
else if (lit_char_is_octal_digit ((ecma_char_t) ch))
|
||||||
&& ch != LIT_CHAR_0)
|
|
||||||
{
|
{
|
||||||
lit_utf8_decr (&parser_ctx_p->input_curr_p);
|
lit_utf8_decr (&parser_ctx_p->input_curr_p);
|
||||||
ch = (ecma_char_t) re_parse_octal (parser_ctx_p);
|
ch = (ecma_char_t) re_parse_octal (parser_ctx_p);
|
||||||
|
|||||||
@@ -133,3 +133,10 @@ assert (r == "abcdefghjklmnopqrstuvwxyz");
|
|||||||
r = new RegExp("[\\u0800-\\uffff]", "g");
|
r = new RegExp("[\\u0800-\\uffff]", "g");
|
||||||
assert (r.test ("\uffff"));
|
assert (r.test ("\uffff"));
|
||||||
assert (!r.test ("\uffff"));
|
assert (!r.test ("\uffff"));
|
||||||
|
|
||||||
|
r = new RegExp("[\0]");
|
||||||
|
assert (r.test ("\0"));
|
||||||
|
assert (!r.test ("0"));
|
||||||
|
|
||||||
|
r = new RegExp("[\0-\1]");
|
||||||
|
assert (r.test ("\1"));
|
||||||
|
|||||||
Reference in New Issue
Block a user