Repository navigation
This release contains a large number of fixes for panics, hangs and large
allocations when reading malformed files. It also contains some breaking
changes, listed below. This is the first in a series of releases that aim to
harden calamine.
These fixes and changes may result in regressions where calamine now rejects a
file that it parsed previously, even if it was unintentional. If you encounter a
case like that, please open a bug report and we will review it.
Changed
-
Breaking:
Range::from_sparse()now returns aResultwith a
CellLimitExceedederror when the range would hold more thanMAX_CELLS
(100 million) cells. Previously a worksheet with cells far apart, such as
A1andXFD1048576, could abort the process while allocating the range.
Issue #693 and PR #697. -
Breaking: The public error enums
Error,XlsxError,XlsbError,
XlsError,OdsError,DeErrorandVbaErrorare now#[non_exhaustive]
so that new error variants can be added without a breaking change. The
unusedXlsError::InvalidFormat,OdsError::AttrErrorand
OdsError::EncodingErrorvariants were removed. -
Breaking:
CellErrorTypeis now#[non_exhaustive]and has variants
for the newer Excel error values such as#SPILL!and#CALC!. In XLSX
files, error values that aren't recognized are returned as
CellErrorType::Otherinstead of failing the whole sheet. Issue #754 and
PR #793. -
Breaking: Replaced the built-in Compound File Binary (CFB) handling with
thecfbcrate. This changes theVbaProject::new()method and drops the
VbaProject::from_cfb()method. It also raises the MSRV from 1.88 to 1.89.
PR #551. -
Updated
zipfrom 9.0 to 9.1 in order to take advantage of additional
protective features. Zip entry names are now matched as bytes, so a zip entry
whose name isn't valid UTF-8 no longer causes an error when a file is opened.
PR #772 and PR #826. -
Improved XLS performance slightly by decoding compressed UTF-16LE strings
without a temporary buffer. PR #809.
Added
-
Added support for reading shared and array formulas in XLSX, XLSB and XLS
files. Previously only the first cell of a filled-down formula range in XLS
and XLSB files returned a formula. Issue #443, PR #712, PR #808 and
PR #788. -
Added
Xlsb::merge_cells_by_sheet_name()and
Xlsb::merge_cells_by_sheet_id()to read merged cells from XLSB files,
matching the existing XLSX and XLS methods. PR #768.
Fixed
-
Fixed XLS and XLSB formulas being returned with the wrong columns,
$
markers or sheets in cell references. PR #776 and PR #779. -
Fixed XLS and XLSB formulas being returned without quotes around sheet
names, so that a reference to'My Sheet'!A1was returned as
My Sheet!A1. PR #780. -
Fixed
>=and>being swapped in formulas returned from XLS and XLSB
files. PR #788. -
Fixed XLSB formulas that use the intersection or union reference operators,
such as=SUM(A1:B2 B1:C3), failing with aPtgerror. PR #777. -
Fixed XLSB formula cells whose cached value is an error, such as a
VLOOKUP()that returns#N/A, being read as empty cells. PR #775. -
Fixed XLSX and XLSB workbooks that contain an Excel 4.0 macro sheet failing
to open. Issue #802 and PR #803. -
Fixed XLS defined names with array constants being read from the wrong
bytes, which could also panic for BIFF5 files. Issue #814 and PR #815. -
Fixed XLS number formats being ignored when the
Formatrecord had an
unexpected id. Issue #798 and PR #804. -
Fixed number formats where an
_,\or*inside quoted text inverted the
quoting of the rest of the format. PR #828. -
Fixed ODS reading of rows with whitespace-only text between cell elements.
Issue #743 and PR #744. -
Fixed XLSX reading of reversed dimension references such as
C5:A1, which
caused an underflow. Issue #692 and PR #695. -
Fixed XLSX table data being shortened by the header row count instead of the
totals row count. PR #829. -
Fixed the following issues with malformed or crafted files, which now return
an error or are read correctly instead of causing a panic, a hang or a large
allocation:- XLSX cell references beyond the grid limits, such as
XFE1or
A1048577. Issue #694 and PR #696. - XLSX shared string tables with a very large
uniqueCount. Issue #684
and PR #797. - XLSX shared formulas with a very large index, tables with very large
ranges or row counts, and tables or pivot tables for sheets at the root of
the file. PR #829. - XLSB records with out-of-range indexes or short lengths. Issue #799 and
PR #800. - XLS sheet offsets past the end of the workbook stream and short workbook
records. Issue #818, PR #822 and PR #823. - XLS
DIMENSIONSrecords with a very large range. Issue #806 and
PR #807. - XLS files and VBA projects with malformed compound file structures.
Issue #764 and PR #551. - ODS files with unclosed
table:tableoroffice:annotationelements,
which looped forever. Issue #773 and PR #774. - Zip files whose local headers don't match the central directory, so that
calamine and other tools could read different data from the same file.
Issue #748 and PR #826.
- XLSX cell references beyond the grid limits, such as
What's Changed
- Fix Clippy test-module ordering in XLSX reader by @awaken in #766
- xlsb: read the relative flags of formula references by @Alex-ley-scrub in #776
- xls: read the relative flags and sheets of formula references by @Alex-ley-scrub in #779
- xlsx: do not pre-allocate the declared number of shared strings by @compiler-segfault in #797
- xlsb: read merged cells by @Alex-ley-scrub in #768
- ods: return an error instead of looping forever on an unclosed table by @jmcnamara in #774
- cfb: replace built-in cfb handling with cfb crate by @jmcnamara in #551
- xlsx: normalise reversed dimension references by @krickert in #695
- ods: accept XML whitespace between cells by @Goldziher in #744
- docs: replace 1.88 with 1.89 in the CONTRIBUTING.md. by @MarcosLH1994 in #805
- tests: add tests for the serde deserialization API by @MarcosLH1994 in #811
- docs: add run instructions to example files by @MarcosLH1994 in #820
- xlsb: return an error on unchecked indexes in malformed files by @hsdfat in #800
- xls: read defined name formulas from after the name by @saisiddharthg in #815
- xls: use the format string of a Format record with any id by @hsdfat in #804
- xlsx/xlsb: read Excel 4.0 macro sheets by @NazarKalytiuk in #803
- xls: do not pre-allocate the declared DIMENSIONS by @jrandolf in #807
- xlsb: read formulas with PtgMemArea, PtgMemErr and PtgMemNoMem by @Alex-ley-scrub in #777
- xls, xlsb: quote sheet names in formulas by @Alex-ley-scrub in #780
- xlsx: error on cell references beyond the grid limits by @krickert in #696
- xls: decode compressed UTF-16LE strings without a temporary buffer by @g4lb in #809
- formats: read
_,\and*inside quoted text as literals by @zzoraemon043 in #828 - tests: replace rstest with plain tests by @jmcnamara in #825
- Zip fixes by @jmcnamara in #826
- Xlsx hardening by @jmcnamara in #829
- xls/xlsb: read shared and array formulas by @jmcnamara in #788
New Contributors
- @compiler-segfault made their first contribution in #797
- @krickert made their first contribution in #695
- @MarcosLH1994 made their first contribution in #805
- @hsdfat made their first contribution in #800
- @saisiddharthg made their first contribution in #815
- @NazarKalytiuk made their first contribution in #803
- @jrandolf made their first contribution in #807
- @g4lb made their first contribution in #809
- @zzoraemon043 made their first contribution in #828
Full Changelog: v0.38.0...v0.39.0