From 6303f3b91725c473b27aaa1b757454d8bd692539 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 59156e5..bd9773a 100644 --- a/crates/format/src/input.rs +++ b/crates/format/src/input.rs @@ -190,7 +190,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, } }