Skip to content

fix(formula): bound expand_range to prevent OOM on giant ranges (#72)#104

Merged
garritfra merged 1 commit into
garritfra:mainfrom
SAY-5:fix/expand-range-bound-72
May 6, 2026
Merged

fix(formula): bound expand_range to prevent OOM on giant ranges (#72)#104
garritfra merged 1 commit into
garritfra:mainfrom
SAY-5:fix/expand-range-bound-72

Conversation

@SAY-5
Copy link
Copy Markdown
Contributor

@SAY-5 SAY-5 commented May 6, 2026

Closes #72.

expand_range in crates/cell-sheet-core/src/formula/eval.rs allocated one CellPos per cell in the range, so =SUM(A1:XFD1048576) would try to materialise ~16 billion entries and OOM-kill the editor before any formula error could surface. This caps a single range at 1,000,000 cells (with overflow-safe arithmetic) and returns #VALUE! past that, matching the issue's proposed fix. Regression test added in eval.rs to lock the bound in place.

@garritfra
Copy link
Copy Markdown
Owner

Lgtm, thank you!

@garritfra garritfra merged commit 0c0fd12 into garritfra:main May 6, 2026
10 checks passed
@github-actions github-actions Bot mentioned this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bound expand_range to prevent OOM on giant ranges

2 participants