From fca801c17e0ec88379839c99dafed25e5c38b603 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sun, 11 Oct 2026 15:43:11 -0400 Subject: [PATCH] INDEX: compare the result size with saturating u64 math, so it can't overflow on 32-bit targets (review fix-up for #400) Co-Authored-By: Claude Opus 5.5 --- crates/calc/src/eval.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/calc/src/eval.rs b/crates/calc/src/eval.rs index adaeeba..a7c677d 100644 --- a/crates/calc/src/eval.rs +++ b/crates/calc/src/eval.rs @@ -1112,7 +1112,7 @@ impl<'h> Evaluator<'h> { }; let (ra, ca) = (as_array(&rows), as_array(&cols)); let (h, w) = (ra.rows.max(ca.rows), ra.cols.max(ca.cols)); - if (h * w) as u64 > MAX_CELLS { + if (h as u64).saturating_mul(w as u64) > MAX_CELLS { return err(CellError::Num); } let mut out = Vec::with_capacity(h * w);