Skip to content

Commit ae11b80

Browse files
committed
Fix count variable calculation in typedarray copyWithin
Fixes #3130 JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
1 parent 2180d97 commit ae11b80

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,16 +1872,16 @@ ecma_builtin_typedarray_prototype_copy_within (ecma_value_t this_arg, /**< this
18721872
}
18731873
}
18741874

1875-
int32_t distance = (int32_t) (end - start);
1876-
int32_t offset = (int32_t) (info.typedarray_length - target);
1877-
int32_t count = JERRY_MIN (distance, offset);
1878-
18791875
if (target >= info.typedarray_length || start >= end || end == 0)
18801876
{
18811877
return ecma_copy_value (this_arg);
18821878
}
18831879
else
18841880
{
1881+
uint32_t distance = end - start;
1882+
uint32_t offset = info.typedarray_length - target;
1883+
uint32_t count = JERRY_MIN (distance, offset);
1884+
18851885
memmove (info.buffer_p + (target * info.element_size),
18861886
info.buffer_p + (start * info.element_size),
18871887
(size_t) (count * info.element_size));

0 commit comments

Comments
 (0)