diff --git a/boa_engine/src/builtins/array/mod.rs b/boa_engine/src/builtins/array/mod.rs index 38f1c31bde1..c31fd8f8a5b 100644 --- a/boa_engine/src/builtins/array/mod.rs +++ b/boa_engine/src/builtins/array/mod.rs @@ -2071,7 +2071,9 @@ impl Array { // c. Let actualDeleteCount be the result of clamping dc between 0 and len - actualStart. let max = len - actual_start; match dc { - IntegerOrInfinity::Integer(i) => (i as usize).clamp(0, max), + IntegerOrInfinity::Integer(i) => { + usize::try_from(i).unwrap_or_default().clamp(0, max) + } IntegerOrInfinity::PositiveInfinity => max, IntegerOrInfinity::NegativeInfinity => 0, }