The PKCS#12 MAC and the PDF security handler's /U, R5/R6 and file-key
checks used plain equality, which stops at the first differing byte and
narrows a guess. Both crates now use a length-checked comparison that
folds every byte (the helper craft-offcrypto already used).
An archive could hold many individually allowed members whose combined
decompression was unbounded, because both readers passed
max_total_bytes: u64::MAX to craft-zip. Each now passes MAX_TOTAL (4 GiB)
and every entry read is charged to it.
craft-fig's declared-entry cap drops from 1,000,000 to 100,000 to match the
other ZIP readers; its images were already bounded by Limits::max_image_total.
- literal_texts now accepts a spaced operand as literal_text does, and the
chain flattens with the spacing kept on its strings, so a chain the Python
check accepts is written flat ("x"& "="&"1", not "x"&( "="&"1")).
- Every BrtBundleSh counts toward the 1,024-sheet cap, a skipped module
sheet too, since each keeps a place in the sheet links.
- Supporting links are capped at 65,536; past it the links aren't read and
formulas keep their saved results.
The review of wordcraft#6345 found that text in code page 932, 936, 949 or 950
was read a byte at a time, each byte above ASCII becoming U+FFFD, and the file
opened with its characters gone. Such a file is refused as every Word 6.0/95
file was before, until the piece walk decodes byte pairs. The test that
asserted the replacement characters is replaced by one that asserts the
refusal and that the same text in a Western font still opens.
The module comment on the Word 6 stylesheet header now matches the reader (a
u16 header size, then the header), as the other review comment asked.
(cherry picked from commit 92f8dd24d1)
Ported from storytold/wordcraft#6317, #6335 and #6345 (one series): Word 6.0
and Word 95 files are read instead of refused: text in its code page (by font
charset, language and style), character and paragraph formatting, tables and
paragraph styles. Paths follow craft-doc-binary (craft-wordmodel,
craft-codepage, craft-cfb).
(cherry picked from commit aa220afc77)
The bridge fell back to decoding in the calling process whenever no worker
was configured, or the worker failed to start, which is exactly the case the
audit called out: acadrust allocates from sizes a hostile file declares, and
an allocation failure or stack overflow ends the process. Conversions are
now refused without a worker, a worker that cannot start is an error, and
allow_in_process() is the explicit opt-in for input known to be trusted.
The reader counted UTF-8 bytes against 255 while the model keeps 128 characters,
so a CJK axis format was written and then dropped on reading. Use MAX_FMT.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The create() API exposed RC4-40 and RC4-128 behind a doc comment, so an app
could write files whose encryption protects nothing. create() now returns
Unsupported for both schemes; create_legacy() and
Document::set_encryption_legacy() are the explicit ways to write a file that
must stay readable by an old reader. Tests and the encrypt example, which
read and write every algorithm, use the legacy entry points.
- A styles table past 65,536 entries, or a gradient past 1,024 stops, is past
a fixed cap: Error::TooLarge, as the error's contract and the other caps
have it, not a damaged part that is skipped with a warning.
- A differential format's font name and number format are charged to
binary_text, as the other string-bearing style records are.
- A formula's array constants share one allowance of 65,536 values, each
array charged before its rows are allocated. Before, the cap was per
array, so a formula of many arrays could hold gigabytes before the formula
text allowance was checked.
- Once binary_formula_text is spent, a formula is not decoded only to be
dropped: it keeps its saved result straight away.
An Excel probe showed two references the decoder refused that .xlsx spells:
- A reference to an XLM macro sheet (Macro1!$A$1): macro sheets have cells,
so the sheet links now name them.
- A 3-D span with a chart sheet between its ends ('Data:After Sheet'!$A$1):
a span is spelled by its ends, as .xlsx has it. An end with no cells is
still refused.
Checked against a wider Excel probe (every worksheet function Excel
accepts, operators, references, constants, spacing, shared and array
formulas), three differences from the .xlsx text are fixed:
- PtgAttrSpace: the spaces and line breaks typed in a formula are kept
where Excel writes them in .xlsx (before an operand, an operator's
symbol or a call, after a parenthesis's or call's opening and before its
closing), and the text is trimmed as the .xlsx reader trims it.
- Numbers are written out in full when that takes at most 21 characters
(100000000000000000000, 0.0000000000000000001), scientific past that
(1E+21, 1.5E-19, 1.23456789012345E-06), as Excel spells them.
- ISO.CEILING, ECMA.CEILING, NETWORKDAYS.INTL and WORKDAY.INTL are called
through hidden _xlfn. names in .xlsb, but .xlsx names them bare.
A broader Excel probe found three differences from the styles.xml Excel
writes for the same workbook:
- A number format with a newer locale tag ([$-ja-JP-x-gannen]) is only in
alternate content: the newer spelling in a block for later versions, and
the one .xlsx keeps as formatCode in a block listing version 12 onwards.
The styles part now reads the alternate content meant for Excel 2007
(version 12), so the format is no longer lost.
- A font whose colour is automatic has no <color> in .xlsx.
- A pattern fill whose pattern colour has a tint states the system
background (bgColor indexed 65), as Excel's .xlsx does for any pattern.
S4790 reports the MD5 and SHA-1 in the xls, pdf and odf cryptography
modules. Each hash is the one the format specifies: a workbook's FilePass
verifier, a PDF revision 2-4 file key, and an OpenDocument start key or
file checksum. A stronger hash derives a different value, so the files
would no longer open. The three files are excluded with the reason
recorded, as the ICC profile ID already is.
Merging main in brought cms.yml, menu.yml and the wasm job back, and their
action refs had no lockfile entries, so `gh actions-lock --verify` failed.
Regenerated with `gh actions-lock`; the four refs it normalized resolve to
the commits already in use.