Skip to content

Commit 6354dd7

Browse files
author
chengzhihao
committed
Fix memcpy param overlap
Signed-off-by: chengzhihao <[email protected]>
1 parent b706935 commit 6354dd7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,8 @@ ecma_builtin_replace_substitute (ecma_replace_context_t *ctx_p) /**< replace con
930930

931931
JERRY_ASSERT (ecma_is_value_string (match_value));
932932
const ecma_string_t *const matched_p = ecma_get_string_from_value (match_value);
933-
const lit_utf8_size_t match_size = ecma_string_get_size (matched_p);
933+
const lit_utf8_size_t match_size_raw = ecma_string_get_size(matched_p);
934+
const lit_utf8_size_t match_size = JERRY_MIN(match_size_raw, ctx_p->string_size);
934935
const lit_utf8_byte_t *const begin_p = ctx_p->string_p + ctx_p->match_byte_pos + match_size;
935936

936937
ecma_stringbuilder_append_raw (&(ctx_p->builder),

0 commit comments

Comments
 (0)