handsontable / handsontable/hyperformula
Array functions: missing max dimension guard causes OOM crash
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.8k
- Forks
- 171
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 7
Description
Severity: Critical
Array-producing functions have no upper bound on output dimensions. Formulas like =SEQUENCE(999999999) or =SEQUENCE("1e308") pass all validation checks and attempt to allocate massive arrays, causing an out-of-memory crash with no error returned.
Reproduction
const hf = HyperFormula.buildFromArray([['=SEQUENCE(999999999)']], { licenseKey: 'gpl-v3' })
// OOM crash — no error returned, process killed
Also crashes: =SEQUENCE("1e308") (string coerces to finite 1e308, passes isFinite check).
Expected behavior
Should return an error. Excel returns #VALUE! when dimensions exceed sheet limits (1048576 rows, 16384 columns).
Affected scope
SequencePlugin— no max dimension check inisValidDimensionorsequenceArraySize- Potentially any function with
sizeOfResultArrayMethodthat accepts user-controlled dimensions
Suggested fix
Add max dimension validation, e.g. derived from Config.maxRows / Config.maxColumns:
private static isValidDimension(n: number): boolean {
return Number.isFinite(n) && n >= SequencePlugin.MIN_DIMENSION && n <= MAX_SAFE_DIMENSION
}
Found during SEQUENCE implementation (PR #1645).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in SequencePlugin, especially isValidDimension and sequenceArraySize, and inspect Config.maxRows and Config.maxColumns for the applicable limits. Then review other functions using sizeOfResultArrayMethod; done means oversized or coerced dimensions return an error instead of attempting an OOM-producing allocation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100