Fixes pattern parsing in ecma_builtin_global_object_unescape ()

Issue #1990 revealed an unhandled corner case while parsing pattern. This patch fixes it and also adds a test case.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2017-09-20 11:54:03 +02:00
committed by yichoi
parent 30867e27e0
commit 15ee7bc036
2 changed files with 21 additions and 0 deletions
@@ -1316,6 +1316,12 @@ ecma_builtin_global_object_unescape (ecma_value_t this_arg, /**< this argument *
hex_digits = (ecma_char_t) (hex_digits * 16 + (ecma_char_t) lit_char_hex_to_int (chr));
status++;
}
else
{
/* Previously found hexadecimal digit in escape sequence but it's not valid '%xy' pattern
* so essentially it was only a simple character. */
status = 0;
}
/* 11-17. Found valid '%uwxyz' or '%xy' escape. */
if (status == 8 || status == 3)