Fix buffer overflow in 'new Function ()' (ecma_builtin_function_dispatch_construct).
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
@@ -190,6 +190,8 @@ ecma_builtin_function_dispatch_construct (const ecma_value_t *arguments_list_p,
|
||||
lit_utf8_size_t str_size = ecma_string_get_size (arguments_str_p);
|
||||
strings_buffer_size = str_size;
|
||||
|
||||
if (str_size != 0)
|
||||
{
|
||||
MEM_DEFINE_LOCAL_ARRAY (start_p, str_size, lit_utf8_byte_t);
|
||||
|
||||
ssize_t sz = ecma_string_to_utf8_string (arguments_str_p, start_p, (ssize_t) str_size);
|
||||
@@ -227,6 +229,7 @@ ecma_builtin_function_dispatch_construct (const ecma_value_t *arguments_list_p,
|
||||
params_count++;
|
||||
|
||||
MEM_FINALIZE_LOCAL_ARRAY (start_p);
|
||||
}
|
||||
|
||||
ECMA_TRY_CATCH (str_arg_value,
|
||||
ecma_op_to_string (arguments_list_p[arguments_list_len - 1]),
|
||||
|
||||
Reference in New Issue
Block a user