Skip to content

Commit 6266c00

Browse files
committed
Safety: Use saturating sub
1 parent 7d2dc20 commit 6266c00

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vm/src/vm/runners/builtin_runner/add_mul_mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ impl ModBuiltinRunner {
433433
memory,
434434
add_mod_inputs.offsets_ptr,
435435
add_mod_index,
436-
add_mod_inputs.n - add_mod_index,
436+
add_mod_inputs.n.saturating_sub(add_mod_index),
437437
)?;
438438
add_mod_n = add_mod_index;
439439
}
@@ -444,7 +444,7 @@ impl ModBuiltinRunner {
444444
memory,
445445
mul_mod_inputs.offsets_ptr,
446446
mul_mod_index,
447-
mul_mod_inputs.n - mul_mod_index,
447+
mul_mod_inputs.n.saturating_sub(mul_mod_index),
448448
)?;
449449
mul_mod_n = mul_mod_index;
450450
}

0 commit comments

Comments
 (0)