From 453066fcf19d71a5e5a9f89fb14023fac702bc33 Mon Sep 17 00:00:00 2001 From: Zoltan Herczeg Date: Tue, 14 Feb 2017 14:18:46 +0100 Subject: [PATCH] Regexp exec should not use the empty magic string. (#1582) This is a workaround for an ASAN issue and a small optimization as well. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com --- jerry-core/ecma/operations/ecma-regexp-object.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/jerry-core/ecma/operations/ecma-regexp-object.c b/jerry-core/ecma/operations/ecma-regexp-object.c index 7f526cdfc..c495d487f 100644 --- a/jerry-core/ecma/operations/ecma-regexp-object.c +++ b/jerry-core/ecma/operations/ecma-regexp-object.c @@ -1249,20 +1249,11 @@ ecma_regexp_exec_helper (ecma_value_t regexp_value, /**< RegExp object */ return ecma_raise_type_error (ECMA_ERR_MSG ("Incompatible type")); } - re_matcher_ctx_t re_ctx; - const lit_utf8_byte_t *input_curr_p = NULL; - ecma_string_t *input_string_p = ecma_get_string_from_value (input_string); ECMA_STRING_TO_UTF8_STRING (input_string_p, input_buffer_p, input_buffer_size); - if (input_buffer_size == 0u) - { - input_curr_p = lit_get_magic_string_utf8 (LIT_MAGIC_STRING__EMPTY); - } - else - { - input_curr_p = input_buffer_p; - } + re_matcher_ctx_t re_ctx; + const lit_utf8_byte_t *input_curr_p = input_buffer_p; re_ctx.input_start_p = input_curr_p; const lit_utf8_byte_t *input_end_p = re_ctx.input_start_p + input_buffer_size;