From 6354dd7aa810f8319ff6d5619066388c104dea8c Mon Sep 17 00:00:00 2001 From: chengzhihao Date: Tue, 9 Dec 2025 09:16:31 +0800 Subject: [PATCH] Fix memcpy param overlap Signed-off-by: chengzhihao <2455457302@qq.com> --- jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c index e298fad4ac..cf5eaf7544 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c @@ -930,7 +930,8 @@ ecma_builtin_replace_substitute (ecma_replace_context_t *ctx_p) /**< replace con JERRY_ASSERT (ecma_is_value_string (match_value)); const ecma_string_t *const matched_p = ecma_get_string_from_value (match_value); - const lit_utf8_size_t match_size = ecma_string_get_size (matched_p); + const lit_utf8_size_t match_size_raw = ecma_string_get_size(matched_p); + const lit_utf8_size_t match_size = JERRY_MIN(match_size_raw, ctx_p->string_size); const lit_utf8_byte_t *const begin_p = ctx_p->string_p + ctx_p->match_byte_pos + match_size; ecma_stringbuilder_append_raw (&(ctx_p->builder),