cvelo
P2 · HighCVSS 7.5

calamine: crafted .xls / .xlsb / .ods files cause panics and unbounded allocations (DoS)

  • RUSTSEC-2026-0628

Description

Show the whole description

The legacy binary parsers in calamine read field offsets, lengths, counts, and indices directly from the input with no bounds validation, so a crafted spreadsheet opened via the public API (`open_workbook`, `Xls::new`, `Xlsb::new`, `Ods::new`) can panic the process or drive an unbounded allocation (OOM). An application that parses untrusted spreadsheets (for example user uploads) is subject to denial of service. The only fuzz target opens input as `.xlsx`, so the `.xls` (BIFF), `.xlsb`, and `.ods` readers are not exercised by fuzzing; the defects live there. This is distinct from RUSTSEC-2026-0436 (the CFB/OLE2 container reader) and from the previously fixed PtgStr/PtgExp formula and BrtName panics - these are the siblings those targeted fixes left in the record/format parsers. ## Representative, confirmed instance (validated) `BoundSheet8.lbPlyPos` is read as a u32 offset (`src/xls.rs:833`) and later used as a slice start `&stream[pos..]` (`src/xls.rs:663`) with no `pos <= stream.len()` check. A `.xls` whose BoundSheet8 record sets lbPlyPos past the stream length panics in `Xls::new`: panicked at src/xls.rs:663:29: range start index 2147483647 out of range for slice of length 37 Reproduced with a benign in-memory unit test that builds a minimal OLE2 container via the `cfb` crate with a crafted Workbook stream and calls `Xls::new` (no network, no exploitation). ## Additional affected sites (same root cause) The byte-read helpers `read_u16`/`read_u32`/`read_i32`/`read_f64` (`src/utils.rs:28-54`) do `s[..N].try_into().unwrap()`, which panics on any record body shorter than N; they are called throughout the BIFF and XLSB record handlers on record bodies whose length is not checked first (for example short or zero-length globals records: FilePass 0x002F, CodePage 0x0042, DateMode 0x0022, BOF 0x0809, ExternSheet 0x0017). Further review surfaced similar unchecked offset/length/index/recursion sites in `src/xls.rs` (MergeCells, Lbl, SST), `src/xlsb/mod.rs` and `src/xlsb/cells_reader.rs` (shared-string index, formula FTAB index, PtgMemFunc unbounded recursion), and `src/ods.rs` (repeat-count and space-count driven allocation); these should be audited as part of the fix. ## Remediation Validate record and field lengths before reading, bound offsets against the stream/record size, cap allocations derived from file-supplied counts, and bound parser recursion - ideally by making the read_* helpers return Result instead of unwrap(). Reported by Copperfault LLC (source review + benign unit-test validation).

Text from the OSV record.

Affected

  • calaminecrates.io

    • from 0.0.0-0, fixed in 0.39.0

Timeline

  1. Published

Related news

No article from the followed outlets names this vulnerability.