Bugfix: should return error immediately in ecma_op_create_typedarray

Related issue: #1936

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
This commit is contained in:
Zidong Jiang
2017-07-24 10:43:05 +08:00
committed by yichoi
parent af2868ddb7
commit a4bc229592
2 changed files with 35 additions and 5 deletions
@@ -689,12 +689,14 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
{
ret = ecma_raise_range_error (ECMA_ERR_MSG ("Maximum typedarray size is reached."));
}
new_byte_length = (ecma_length_t) new_length << element_size_shift;
if (new_byte_length + offset > buf_byte_length)
else
{
ret = ecma_raise_range_error (ECMA_ERR_MSG ("Invalid length."));
new_byte_length = (ecma_length_t) new_length << element_size_shift;
if (new_byte_length + offset > buf_byte_length)
{
ret = ecma_raise_range_error (ECMA_ERR_MSG ("Invalid length."));
}
}
ECMA_OP_TO_NUMBER_FINALIZE (num3);