mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-02 22:50:27 -06:00
A footnote reference clones its note and walks it again, and an XLSX shared string is copied per cell that uses it, so one 1 MB footnote referenced 100k times meant around 100 GB. The text is kept at the first reference; later ones get the mark and an empty note, and the report says so. The spreadsheet reader stops at 64 MB of text and 400,000 collected cells. Carries both review fixes: - a footnote id is recorded only once its text has actually been kept, so a first reference arriving after the budget was spent no longer counts as "done" and tell the next reference the text is at a reference that has none; - the report and the note budget are both bounded. The duplicate warning names the id, so 400 ids referenced twice made 400 warnings, each pushed after a Vec::contains scan of all the earlier ones; warnings go through warn() now, which dedups through a set and stops at 100 distinct messages. And the budget counted only `text`, which holds a table's anchor and not its cells, so 18 notes of 600 KB of cell text retained 10,800,072 bytes against the 8 MB budget; note_bytes() walks the tables and their nested tables. Rebased onto the post-split main: the implementation stays in docx.rs and the tests moved to docx/tests.rs, so the test additions went there.