[Bug]: An array literal with a large array element throws "Maximum call stack size exceeded"

Abierto
#1,878 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
74/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
node.js, typescript
Área
backend, data

Línea de trabajo

Start with Interpreter.ts and the ARRAY branch of Interpreter.evaluateAst at the listed lines 266, 269, 278, and 280. Check how large arrays are passed to push() and run the relevant evaluator tests with the supplied 40,000-row formula. Done means the array literal evaluates without a RangeError and the formula cell can be read.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Bug
Description

An array literal with a large array as an element throws a RangeError from buildFromArray and setCellContents:

const data = Array.from({length: 40000}, () => [1])
data[0].push('=SUM({VSTACK(A1:A40000,A1:A40000,A1:A40000,A1:A40000)})')

HyperFormula.buildFromArray(data, {licenseKey: 'gpl-v3'})
// RangeError: Maximum call stack size exceeded

Without the braces, =SUM(VSTACK(A1:A40000,A1:A40000,A1:A40000,A1:A40000)) returns 160000, as the equivalent formula does in Microsoft Excel Online. In Node.js 22 the error starts at about 125,000 rows or columns in one element. After it is thrown by setCellContents, the formula is stored, but reading the cell throws Value of the formula cell is not computed.

Cause: the ARRAY branch of Interpreter.evaluateAst spreads element arrays into push() (Interpreter.ts:266, :269, :278 and :280). Each spread passes one argument per row or value, and large arrays exceed the JavaScript engine's limit on the number of arguments in a call.

Expected: the array literal is built for any size that the other array functions accept.

Video or screenshots

N/A

Demo

Code snippet in the description.

HyperFormula version

3.5.0 (also develop at ec7512d21)

Your framework

None (Node.js)

Your environment

Node.js 22.23.4 on Linux

Lenguaje dominante
TypeScript
Estrellas
2.8k
Forks
175
Merge medio
2 d 5 h
PR fusionados (30 d)
23

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de handsontable/hyperformula

Todos los issues de handsontable/hyperformula

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.