xlsx: error on cell references beyond the grid limits - #696
Open
krickert wants to merge 3 commits into
Open
Conversation
This was referenced Jul 27, 2026
Collaborator
|
This PR is fixing the wrong thing. Rather than handling U32 overflow it should be handling invalid row/column dimensions and raising an error. |
Row and column accumulation is now checked, and references past MAX_ROWS / MAX_COLUMNS return RowNumberOverflow / ColumnNumberOverflow. Fixes tafia#694
krickert
force-pushed
the
fix/cellref-overflow
branch
from
July 29, 2026 15:42
81e41b3 to
15fad0f
Compare
Author
|
Done. The lenient warn! path in
|
Author
|
Reworked to reject invalid references as requested, let me know what you think. |
krickert
added a commit
to ai-pipestream/calamine
that referenced
this pull request
Aug 20, 2026
Brings pipestream-main from 0.36.0 + the original fix commits to upstream/master at 0.36.1+ plus the post-review heads of the three open upstream PRs: tafia#695 dimension normalisation (Dimensions::new) tafia#696 grid-limit errors from cell reference parsing tafia#697 Range::from_sparse returns Result<Range<T>, RangeError> The tafia#697 head changes a public signature; the tree is byte-identical to upstream/master with the three fix branches merged (verified by diff), and the calamine test suite passes on that tree (46+164+65 tests).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #694.
Both accumulators in
get_row_and_optional_columnwere unchecked u32, so a reference likeZZZZZZZ1orA99999999999panicked in debug builds and wrapped in release builds, yielding cell positions that appear nowhere in the file.As requested in review, the fix rejects invalid references instead of guarding the arithmetic: row and column accumulation is checked, and a reference past the grid (row > 1,048,576 or column > 16,384) returns the existing
XlsxError::RowNumberOverflow/ColumnNumberOverflow. Dimension parsing propagates the same errors, replacing the warn-and-continue path inget_dimension. The column step moved intopush_column_letterso the uppercase and lowercase arms stay identical.test_reference_beyond_grid_is_an_errorcovers one past the grid on each axis, references that overflow u32 entirely, the same throughget_dimension, and the bottom-right cellXFD1048576, which still parses.Touches the same
get_dimensionarm as #695; whichever lands second gets rebased.