Skip to content

Conversation

@withzombies
Copy link

Fix DoS vulnerability where malicious ODS files can exhaust memory by declaring billions of repeated cells via table:number-rows-repeated and table:number-columns-repeated XML attributes.

  • Add caps matching XLSX limits: 1M rows, 16K columns, 100M total cells
  • Return OdsError::CellLimitExceeded instead of silently returning empty range when limits exceeded
  • A 7KB malicious file can no longer attempt to allocate memory for 17+ billion cells

Fixes #594

Add limits to prevent memory exhaustion from malicious ODS files that
declare billions of repeated cells via table:number-rows-repeated and
table:number-columns-repeated attributes.

Protection layers:
- Cap columns per row at MAX_COLUMNS (16,384)
- Cap total row repeats at MAX_ROWS (1,048,576)
- Cap total cells at MAX_CELLS (100 million) in get_range()

These limits match XLSX's existing row/column limits and prevent a 7KB
malicious file from attempting to allocate memory for 17+ billion cells.

When MAX_CELLS is exceeded, return OdsError::CellLimitExceeded instead
of silently returning an empty range. This ensures callers are properly
informed of truncation rather than receiving silent data loss.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: DoS via repeated rows/columns in ODS files

1 participant