Repository navigation
Conversation
pierreneter
reviewed
Nov 18, 2026
pierreneter
left a comment
Member
There was a problem hiding this comment.
Thanks for looking into this. The bounds reject more than they need to, and files that opened fine now lose data without a word, so I can't merge it as it is. Line numbers are at 3751c55.
Reproduced against this branch and its base:
src/core/xlsx/workbook.ts:168: a row height above 409.5pt is dropped, not clamped.<row r="1" ht="488" customHeight="1">gives no height at all (base: 651px). Our own converters write such heights (src/core/iwork/numbers.ts:312,src/core/legacy/xls/sheet.ts:458).workbook.ts:196: a<col>withwidth > 255ormax > 16384is dropped whole, together with itshiddenflag.<col min="2" max="2" width="300" hidden="1"/>becomes a visible column of default width. Base accepted the width and clampedmax.workbook.ts:62:worksheetRefaccepts uppercase only.<c r="a1">and<mergeCell ref="a1:b1"/>load as nothing, so the workbook opens as an empty sheet with no error.colIndexfolds case, and base read both.workbook.ts:133: a cell whose ref names another row than the row counter is dropped.<row><c r="A1"/></row><row><c r="A3"><v>3</v></c></row>shows only A1. Base kept the cell.workbook.ts:163: rows past 1,048,576 are now dropped at load. That bypasses the notice we already have for this ("over Excel's 1,048,576-row limit: save as CSV",XlsxView.tsx:236) and the save guard (editor.ts:910): the sheet shows 1,048,576 rows with no warning, and the text export is cut. The cutoff is right for a sparse multi-billion coordinate; dense over-limit data should keep the existing path.- Same place: the loader skips an invalid row or cell without advancing its implicit counters, but
RowPatcherstill counts them on save (editor.ts:1297,:1345).<row r="5">,<row r="1048577">, then a<row>with a value: edit A6, save, reopen. The edit is in row 6 and the overwritten value is back in row 7. src/core/xlsx/limits.ts:13:Number()accepts hex, exponent and padded forms.r="0x10"loads as row 16, whileRowPatcher's\d+does not match it, which is the same loader / saver disagreement./^\d+$/for integer attributes closes it.
From reading:
- The hang in the title is still reachable.
<pane state="frozen" ySplit="1048575"/>passes (workbook.ts:203), and the frozen region is not virtualised:XlsxView.tsx:1702and:1708renderregion('top', 0, fr - 1, ...)and the row headers for about a million rows, and the effect at:599callsstore.ensure(sheet, 0, frozen.rows - 1)on every render. Clamping the frozen region to the viewport in the view is the fix;d.frozenis also set from sheet ops without a check. src/core/xlsx/drawings.ts:62: an anchor with a missing or non-integercolOff/rowOffis now dropped. Base took the offset as 0 and still showed the picture. I'd reject oncol/rowonly.
In short: clamp sizes rather than drop them, keep a cell wherever a sane reading exists, and leave dense over-limit rows to the existing notice.
Non-blocking:
- Parsing 250k rows x 12 cells is about 10-25% slower here: a regex test, a
replaceand a tuple per cell in the SAX path. One char-code scan can parse and bound-check column and row together. test/xlsx-bounds.test.ts:134assertsstderr === ''and kills the child after 5 s. Any warning on stderr or a cold transpile on a loaded runner fails it. The exit code plus a stdout marker is sturdier.MAX_ROWS/MAX_COLSstay duplicated insrc/core/legacy/odf/ods.tsandsrc/core/legacy/xls/sheet.ts; the converters and the new validator can drift apart, which is how 1 comes about.
This branch has not been deployed
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.
Malformed drawing anchors or worksheet rows could expand the grid to billions of rows, where signed 32-bit midpoint arithmetic could make axis lookup loop indefinitely.
Validate OOXML coordinates and geometry, discard invalid records, and bound drawing-derived extents to worksheet limits. Axis searches now use arithmetic midpoints without imposing Excel's row limit on intentional large CSV imports.
Follows up on the non-blocking feedback in #11. Invalid OOXML rows/cells/columns/merges/anchors are skipped, and sizes, offsets, defaults and frozen-pane metadata are validated.
Validation with Bun 1.4.4: frozen dependencies, typecheck, all 552 unit tests and production build passed. Regressions cover corrupt records in a time-bounded process, valid worksheet boundaries, bounded large-axis searches and preservation of large loader counts. An independent review passed additional Axis-oracle, malformed-record, extreme-metadata and bounded-browser checks.
Limits: no physical 500-million-row CSV import was rerun. Frozen-pane rendering remains unvirtualized as on
main; this PR does not claim a general rendering-resource cap.