From: Alexander Borisov Date: Tue, 16 Jul 2019 14:32:11 +0000 (+0300) Subject: Fixed String.prototype.match() for byte strings with regex arg. X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=54cbb4f9f83ed1efa2c42b6ecc7d85c1f0ee67b3;p=njs.git Fixed String.prototype.match() for byte strings with regex arg. --- diff --git a/njs/njs_string.c b/njs/njs_string.c index c6190d0b..69d2f492 100644 --- a/njs/njs_string.c +++ b/njs/njs_string.c @@ -2757,7 +2757,8 @@ njs_string_match_multiple(njs_vm_t *vm, njs_value_t *args, if (captures[1] == 0) { if (start < end) { - p = nxt_utf8_next(start, end); + p = (utf8 != NJS_STRING_BYTE) ? nxt_utf8_next(start, end) + : start + 1; string.size = end - p; } else { diff --git a/njs/test/njs_unit_test.c b/njs/test/njs_unit_test.c index c0ec3804..eecb0a24 100644 --- a/njs/test/njs_unit_test.c +++ b/njs/test/njs_unit_test.c @@ -5832,6 +5832,9 @@ static njs_unit_test_t njs_test[] = "a +' '+ a.length"), nxt_string("αα 4") }, + { nxt_string("typeof String.bytesFrom(Array(15).fill(0xE3)).match(/^/g)"), + nxt_string("object") }, + { nxt_string("'abc'.split()"), nxt_string("abc") },