From 799f07f04fc861d207cddf9c857a581e795a3d0c Mon Sep 17 00:00:00 2001 From: Omar Abdulla Date: Wed, 23 Jul 2025 09:54:58 +0300 Subject: [PATCH] Fix size_requirement underflow --- crates/format/src/input.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/format/src/input.rs b/crates/format/src/input.rs index 689ca23..e031cd2 100644 --- a/crates/format/src/input.rs +++ b/crates/format/src/input.rs @@ -159,7 +159,11 @@ impl Calldata { pub fn size_requirement(&self) -> usize { match self { - Calldata::Single(single) => (single.len() - 2) / 2, + Calldata::Single(single) => single + .len() + .checked_sub(2) + .and_then(|value| value.checked_div(2)) + .unwrap_or_default(), Calldata::Compound(items) => items.len() * 32, } }