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:
committed by
László Langó
parent
c61e822a45
commit
dc83e995d2
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user