Add bounds check for copyWithin (#3425)
When inputs are out of bounds, we don't need to do anything in the operation. Fixes #3408 JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
committed by
Dániel Bátyai
parent
99fa823bab
commit
e70cfed57a
@@ -2338,6 +2338,12 @@ ecma_builtin_array_prototype_object_copy_within (const ecma_value_t args[], /**<
|
||||
}
|
||||
}
|
||||
|
||||
if (target >= len || start >= end || end == 0)
|
||||
{
|
||||
ecma_ref_object (obj_p);
|
||||
return ecma_make_object_value (obj_p);
|
||||
}
|
||||
|
||||
uint32_t count = JERRY_MIN (end - start, len - target);
|
||||
|
||||
bool forward = true;
|
||||
|
||||
Reference in New Issue
Block a user