Vulnerability GHSA-cgc7-9qp3-86m3
Summary
Docling: Unbounded table rowspan/colspan in HTML, JATS, ODS and BoxNote backends causes CPU/memory exhaustion
Details
Summary
The HTML, JATS, ODS (OpenDocument spreadsheet) and BoxNote backends accept table rowspan / colspan values without an upper bound. A few bytes of input, such as <td rowspan="100000000">, make docling run loops proportional to the declared span and allocate a table grid of the declared size. The result is CPU and memory exhaustion.
Details
docling/backend/html_backend.py(_get_cell_spans) parses span attributes with no upper limit. The cell-filling loop then iteratesrow_span × col_spantimes.docling/backend/jats_backend.pyanddocling/backend/boxnote_backend.pyfill their tables the same way.- The OpenDocument spreadsheet path scans the declared span range.
- Export (for example
export_to_markdown()) materialises the full grid throughTableData.gridin docling-core.
document_timeout does not bound this. It is checked between pipeline stages, and these backends convert the whole document in a single call. max_file_size and max_num_pages do not help because the payload is tiny.
Measured on 2.130.0: a 54-byte HTML file with rowspan="1e8" takes about 4.4 s of CPU, and the time grows linearly with the value. A 52-byte file with colspan="3000000" takes about 23 s and reaches 4.5 GB peak memory during Markdown export.
Impact
Denial of service of the converting process from a very small input document. Confidentiality and integrity are not affected.
Proof of concept
<table><tr><td colspan="3000000">x</td></tr></table>
from docling.document_converter import DocumentConverter
DocumentConverter().convert("span.html").document.export_to_markdown()
Patches
Fixed in docling 2.131.0 by #4414. Table spans are clamped to the HTML limits (colspan 1000, rowspan 65534) and to the actual size of the table in the HTML, JATS, BoxNote and OpenDocument spreadsheet backends, so conversion time and memory grow with the real table only.
Workarounds
Upgrade to 2.131.0. For older versions:
Run conversions of untrusted documents in a separate process with memory and CPU-time limits, or restrict allowed_formats to formats that are not affected.
Related Vulnerabilities
Other vulnerabilities affecting the same packages