fix: infinite loop due to hidden row in XLSX.stream.to_json #3178

Merged
sheetjs merged 2 commits from deepak-negi-web/sheetjs:patch-1 into master 2024-08-21 05:34:34 +00:00
Contributor

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:

  • Code changes have been tested locally.
  • 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.


**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. ---
deepak-negi-web added 1 commit 2024-08-14 12:34:19 +00:00
deepak-negi-web added 1 commit 2024-08-20 06:24:11 +00:00
sheetjs merged commit 5550b90704 into master 2024-08-21 05:34:34 +00:00
sheetjs deleted branch patch-1 2024-08-21 05:34:35 +00:00
Sign in to join this conversation.
No description provided.