Fix for Issue #744

Don't increment the current position in case of a continuation byte.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
This commit is contained in:
robertsipka
2016-09-08 14:05:14 +02:00
committed by László Langó
parent c61e822a45
commit dc83e995d2
2 changed files with 10 additions and 1 deletions
@@ -1017,7 +1017,11 @@ ecma_builtin_string_prototype_object_replace_get_string (ecma_builtin_replace_se
previous_start = current_position + 1;
}
current_position++;
/* if not a continuation byte */
if ((*replace_str_curr_p & LIT_UTF8_EXTRA_BYTE_MASK) != LIT_UTF8_EXTRA_BYTE_MARKER)
{
current_position++;
}
}
if (ecma_is_value_empty (ret_value))
+5
View File
@@ -32,6 +32,11 @@ assert ("1234".replace(23, 32) === "1324");
assert ("abcabc".replace(/bc/, ":") === "a:abc");
assert ("axbcxx".replace(/x*/g, ":") === ":a::b:c::");
assert ("".replace(/|/g,"஻") === "஻");
assert ("஻BB8B@abXde^".replace(/a/g,"$஻Bce((/a%") === "஻BB8B@$஻Bce((/a%bXde^");
assert ("abcab".replace(/a/g,"˙Ł$Đ") === "˙Ł$Đbc˙Ł$Đb");
assert ("˙Ł$Đbc˙Ł$Đb".replace("Ł$","ab") === "˙abĐbc˙Ł$Đb");
assert (String.prototype.replace.call (12321, /2/g, ".") === "1.3.1");
try