📗 SheetJS Community Edition -- Spreadsheet Data Toolkit
Go to file
deepak-negi-web 5550b90704 fix: infinite loop due to hidden row in XLSX.stream.to_json (#3178)
**Title:**

Fix for Incorrect Row Indexing and Infinite Loop in stream.to_json Function

**Description:**

This pull request addresses two key issues in the `stream.to_json` function of the SheetJS library:

1. **Infinite Loop**: Previously, when a row was hidden, the function skipped processing the current row without incrementing the row counter `R`, resulting in an infinite loop during execution.

2. **Incorrect Row Indexing**: The row index was incorrectly accessed using a one-based index, whereas the actual row index was zero-based. This led to unintended hidden rows being included in the stream and skipping of subsequent non-hidden rows.

**Changes:**

- Modified the hidden row check to use the correct zero-based indexing
- Incremented `R` after identifying a hidden row to ensure the loop progresses to the next row.
- Ensured that the stream correctly processes all rows, skipping hidden rows without affecting subsequent rows.

**Testing:**

- Validated that the `stream.to_json` function no longer enters an infinite loop when encountering hidden rows.
- Confirmed that the correct rows are processed and pushed to the stream, with hidden rows being appropriately skipped.

**Impact:**

This fix enhances the reliability of the SheetJS library, ensuring accurate data streaming from spreadsheets without infinite loops or incorrect row handling.

**Checklist:**

- [x] Code changes have been tested locally.
- [x] The changes adhere to the project's coding standards and guidelines.

**Additional Information:**

These changes are crucial for maintaining the library's functionality in production environments, where precise data handling is essential.

**References:**

Closes #3176.

---

Reviewed-on: sheetjs/sheetjs#3178
Co-authored-by: deepak-negi-web <deepak-negi-web@noreply.git.sheetjs.com>
Co-committed-by: deepak-negi-web <deepak-negi-web@noreply.git.sheetjs.com>
2024-08-21 05:34:31 +00:00
.github Delete .github/ISSUE_TEMPLATE/config.yml 2023-08-18 15:26:54 +00:00
bin version bump 0.18.5: basic NUMBERS write 2022-03-24 09:59:49 -04:00
bits fix: infinite loop due to hidden row in XLSX.stream.to_json (#3178) 2024-08-21 05:34:31 +00:00
dist version bump 0.20.3 2024-07-12 11:47:14 -04:00
misc version bump 0.19.3 2023-04-17 23:39:28 -04:00
modules version bump 0.20.3 2024-07-12 11:47:14 -04:00
packages actually remove test_files submodule 2024-07-19 14:57:19 -04:00
tests version bump 0.20.3 2024-07-12 11:47:14 -04:00
types NaN and Infinity error export 2024-07-04 15:54:34 -04:00
.eslintignore [Tests] migrate tests to Github Actions 2021-04-08 11:21:37 -07:00
.eslintmjs clean cptable global pollution 2022-03-11 01:16:24 -05:00
.eslintrc version bump 0.19.3 2023-04-17 23:39:28 -04:00
.flowconfig switch to cfb for zip operations 2022-02-10 08:22:36 -05:00
.gitattributes wsl build sequence fixes 2022-05-16 21:26:22 -04:00
.gitignore dta initial 2023-11-13 06:13:07 -05:00
.gitmodules actually remove test_files submodule 2024-07-19 14:57:19 -04:00
.jscs.json version bump 0.7.6: IE compatibility 2014-06-05 03:06:20 -04:00
.jshintrc version bump 0.8.0: unification with js-xls 0.7.5 2015-04-02 16:32:22 -04:00
.npmignore version bump 0.20.0 2023-06-23 05:48:47 -04:00
.spelling removed sheet_to_dif IIFE 2022-08-30 03:00:32 -04:00
.travis.yml Fixed failing travis builds (#2040) 2020-07-01 20:56:41 -04:00
bower.json switch to cfb for zip operations 2022-02-10 08:22:36 -05:00
CHANGELOG.md XLSX encoded entities (fixes #3177) 2024-08-19 12:43:37 -04:00
CONTRIBUTING.md ssf format NaN and Infinity values 2024-04-27 19:49:12 -04:00
estk.jsx estk test [ci skip] 2022-05-20 04:56:18 -04:00
index.html newline normalization 2022-04-20 13:31:11 -04:00
LICENSE fixed flow typecheck 2019-10-31 23:09:14 -04:00
make.cmd Browser and Node ESM support 2021-09-12 07:19:09 -04:00
Makefile NaN and Infinity error export 2024-07-04 15:54:34 -04:00
multiformat.lst version bump 0.11.6: ancillary format update 2017-10-16 20:14:32 -04:00
package.json XLSX encoded entities (fixes #3177) 2024-08-19 12:43:37 -04:00
README.md actually remove test_files submodule 2024-07-19 14:57:19 -04:00
shim.js version bump 0.13.0: AMD support 2018-06-01 12:32:08 -04:00
test.js XLSX encoded entities (fixes #3177) 2024-08-19 12:43:37 -04:00
test.mjs NaN and Infinity error export 2024-07-04 15:54:34 -04:00
test.mts merge nits (fixes #3142 h/t @s-ashwin ) 2024-07-11 01:33:25 -04:00
test.sh NaN and Infinity error export 2024-07-04 15:54:34 -04:00
test.test.mjs NaN and Infinity error export 2024-07-04 15:54:34 -04:00
test.ts merge nits (fixes #3142 h/t @s-ashwin ) 2024-07-11 01:33:25 -04:00
testnocp.ts merge nits (fixes #3142 h/t @s-ashwin ) 2024-07-11 01:33:25 -04:00
tests.lst do not bail when XLS properies cannot be parsed 2024-07-17 14:23:02 -04:00
xlsx.flow.js version bump 0.20.3 2024-07-12 11:47:14 -04:00
xlsx.full.min.js version bump 0.20.2 2024-04-04 21:30:28 -04:00
xlsx.js version bump 0.20.3 2024-07-12 11:47:14 -04:00
xlsx.mini.flow.js version bump 0.20.3 2024-07-12 11:47:14 -04:00
xlsx.mini.js version bump 0.20.3 2024-07-12 11:47:14 -04:00
xlsx.mjs version bump 0.20.3 2024-07-12 11:47:14 -04:00
xlsxworker.flow.js xlsx-cli 1.1.3 [ci skip] 2022-04-16 02:18:29 -04:00
xlsxworker.js xlsx-cli 1.1.3 [ci skip] 2022-04-16 02:18:29 -04:00

SheetJS

The SheetJS Community Edition offers battle-tested open-source solutions for extracting useful data from almost any complex spreadsheet and generating new spreadsheets that will work with legacy and modern software alike.

SheetJS Pro offers solutions beyond data processing: Edit complex templates with ease; let out your inner Picasso with styling; make custom sheets with images/graphs/PivotTables; evaluate formula expressions and port calculations to web apps; automate common spreadsheet tasks, and much more!

Documentation

Constellation

  • https://oss.sheetjs.com/notes/: File Format Notes

  • ssf: Format data using ECMA-376 spreadsheet format codes

  • xlsx-cli: NodeJS command-line tool for processing files

  • cfb: Container (OLE/ZIP) file processing library

  • codepage: Legacy text encodings for XLS and other legacy spreadsheet formats

  • dta: Stata DTA file processor

License

Please consult the attached LICENSE file for details. All rights not explicitly granted by the Apache 2.0 License are reserved by the Original Author.