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 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas 2026-10-11 15:43:11 -04:00
parent fbb2285532
commit fca801c17e
1 changed files with 1 additions and 1 deletions

View File

@ -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);