Commit Graph
3038 Commits
Author SHA1 Message Date
Dylan M. Taylor c86ea6802a craft-ora, craft-kra: charge every entry to one document-wide total (#1339)
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.
2026-11-14 13:45:31 -05:00
kiwi4boy aa622a2e20 Merge branch 'xlsb-formulas' into xlsb-styles
# Conflicts:
#	crates/xlsx/tests/xlsb.rs
2026-11-14 13:32:25 -05:00
Dylan M. Taylor 74509ff055 Merge pull request #1351 from storytold/fix/reland-word6-doc-reader
craft-doc-binary: re-land Word 6.0/95 reader on main
2026-11-14 13:28:47 -05:00
kiwi4boy 24e6266119 craft-xlsx: review fixes: spaced string chains flatten, module sheets and supporting links are capped
- 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.
2026-11-14 13:27:25 -05:00
Dylan M. Taylor 3032d970a6 craft-doc-binary: Word 6.0/95 text in an East Asian code page is refused, not lost
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)
2026-11-14 13:27:16 -05:00
kiwi4boy 387eab39f4 .doc import: Word 6.0/95 files open with their text, formatting, tables and styles
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)
2026-11-14 13:27:16 -05:00
batistalucasv 80ed9665e7 craft-docx: preserve w:numberingChange without active list and raise w:original bound 2026-11-14 15:25:54 -03:00
Dylan M. Taylor 81e1dcec5a craft-dwg: refuse to convert without a worker instead of running acadrust here
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.
2026-11-14 13:16:57 -05:00
vangel76andClaude Sonnet 5.5 0edccaf1bc docx: category gridlines follow line and area points when the axis crosses mid
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 18:59:56 +01:00
vangel76andClaude Sonnet 5.5 40d27e4ede docx: bar category labels start after the axis title strip
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 18:59:56 +01:00
vangel76andClaude Sonnet 5.5 ca3390ec17 wordmodel: ChartSpec::default uses the value-axis preset
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 18:58:38 +01:00
vangel76andClaude Sonnet 5.5 e1cd8b5e01 docx: no_fill wins over a stored series colour
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 18:58:38 +01:00
vangel76andClaude Sonnet 5.5 4d8273712e docx: count chart axis format characters like the model
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>
2026-11-14 18:58:38 +01:00
Dylan M. Taylor d74e60b2d5 craft-pdf: refuse to create RC4 encryption without an explicit legacy call
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.
2026-11-14 12:57:23 -05:00
Dylan M. Taylor b6b222afb0 fix(prepress): address PDF/X review findings 2026-11-14 17:45:53 +00:00
kiwi4boy 88287a6b46 craft-xlsx: review fixes: styles caps are too large, differential format strings are charged
- 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.
2026-11-14 12:40:55 -05:00
Dylan M. Taylor f5720d8f69 refactor(xml): share bounded tree-node validation 2026-11-14 17:36:14 +00:00
kiwi4boy 14e516edf4 Merge branch 'xlsb-formulas' into xlsb-styles 2026-11-14 12:36:13 -05:00
kiwi4boy fa5457bed6 craft-xlsx: review fixes: array constants bounded per formula, a spent allowance skips decoding
- 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.
2026-11-14 12:35:54 -05:00
Cédric Legrand 1a4e11926c refactor(dwg): apply behavior-preserving cleanups 2026-11-14 18:26:23 +01:00
Dylan M. Taylor bac1a19d93 fix(xml): harden DTD validation bounds and parsing 2026-11-14 17:10:03 +00:00
kiwi4boy 259afde541 Merge branch 'xlsb-formulas' into xlsb-styles
# Conflicts:
#	crates/xlsx/README.md
#	crates/xlsx/tests/xlsb.rs
2026-11-14 12:04:49 -05:00
kiwi4boy 5742279729 craft-xlsx: binary formulas name macro sheets and span chart sheets
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.
2026-11-14 12:01:46 -05:00
kiwi4boy abceed3f17 craft-xlsx: binary formulas keep typed spacing and Excel's number spelling
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.
2026-11-14 11:56:51 -05:00
Cédric Legrand 271a2a7296 style: remove review churn 2026-11-14 17:49:47 +01:00
Cédric Legrand 99223e1972 refactor(i18n): satisfy Clippy pedantic lints 2026-11-14 17:49:46 +01:00
Dylan M. Taylor 7ad4765ee5 Merge pull request #1325 from storytold/codex/docx-level-presence
docx: retain explicitly defined numbering levels
2026-11-14 11:48:48 -05:00
Dylan M. Taylor 3e399149a8 Merge pull request #1316 from storytold/sonar/s4790-format-hash-exclusions
sonar: ignore the weak hashes the encrypted formats require (SonarCloud S4790)
2026-11-14 11:47:14 -05:00
Dylan M. Taylor c9bf4a34a6 Merge pull request #1242 from alehel/claude/issue-1230-c0c8eb
craft-audio: write AAC, ALAC, MP3, AC-3 and E-AC-3 files
2026-11-14 11:46:38 -05:00
Dylan M. Taylor 874c94f2b1 Merge pull request #1311 from pakiat/fix/field-results-complex-script
craft-docx: a field's Thai result takes the complex-script formatting only where Word does
2026-11-14 11:43:58 -05:00
Dylan M. Taylor 9053f5389f Merge pull request #1225 from Bra1nZ/fix/7230-legacy-v3-driver-zero-media-side
fix(print): trust one side of a legacy V3 driver's paper metric
2026-11-14 11:43:38 -05:00
Dylan M. Taylor d542e68c5b Merge pull request #1305 from TrevorBrown-dev/fix/web-jpeg-oversized-xmp
image-codecs: the web JPEG encoder trims or leaves out an XMP packet past one segment
2026-11-14 11:40:56 -05:00
Dylan M. Taylor 1f96d6b6bb Merge pull request #1278 from naxvog/docx/cell-margins-without-table-style
craft-docx: a file with no default table style gives its tables no cell margins
2026-11-14 11:36:33 -05:00
Dylan M. Taylor 689bd18cb6 Merge pull request #147 from midasmatterhorn/fix/r4-print-shrink-zero-scale
print: shrink-to-fit refuses a sheet the written matrix cannot represent
2026-11-14 11:34:07 -05:00
kiwi4boy d2b6416db9 craft-xlsx: binary styles: legacy number formats, automatic font colours, tinted fills
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.
2026-11-14 11:32:40 -05:00
Dylan M. Taylor 29fb8f8e86 Merge pull request #1216 from dotCooCoo/feat/craft-texture-planes
craft-texture: add bounded float image planes and texture sampling
2026-11-14 11:28:44 -05:00
Cédric Legrand 12656b3d0f docs(dxf): describe configurable tag limit 2026-11-14 17:20:40 +01:00
Dylan M. Taylor 15b013b305 Merge pull request #637 from dotCooCoo/fix/linesweeper-sweep-doc-left-scan
linesweeper: the left intersection scan in docs/sweep.typ compares with alpha^(i+1)
2026-11-14 11:19:24 -05:00
Dylan M. Taylor 553d10d5a4 Merge pull request #1221 from dotCooCoo/fix/hdr-isize-bound
craft-hdr: refuse buffers past isize::MAX bytes when limits are raised
2026-11-14 11:17:00 -05:00
Dylan M. Taylor 19a4929a80 Ignore reader provenance in numbering equality 2026-11-14 15:38:05 +00:00
Dylan Taylor 630c570789 fix: update tests for vorbis-encode feature (ogg support) 2026-11-14 10:16:33 -05:00
Dylan M. Taylor a5ac3aa05c Merge pull request #1322 from storytold/codex/craft-xml-dtd
prepress: share PDF/X-1a finalization and checks (official replacement)
2026-11-14 10:14:26 -05:00
Dylan M. Taylor 5c8e1b0d82 docx: retain explicit numbering level presence 2026-11-14 15:10:43 +00:00
Dylan M. Taylor bcd09376d0 sonar: ignore the weak hashes the encrypted formats require
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.
2026-11-14 10:06:14 -05:00
Dylan M. Taylor ebece3ff5c ci: lock the actions main added while this branch was open
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.
2026-11-14 10:05:44 -05:00
Dylan M. Taylor a1c851730a Merge branch 'main' into chore/lock-github-actions 2026-11-14 10:03:13 -05:00
Dylan M. Taylor b9c1dfa18f feat(audio): migrate Ogg Vorbis encoding to craft-audio (PR #26)
- Add vorbis-encode feature with dep:vorbis_rs = "0.5"
- Implement encode_ogg() via VorbisEncoderBuilder matching original behavior:
  - Fixed stream serial 0x4C43_5246, VBR target bitrate (64-500 kbit/s)
  - 4096-frame blocks, panic catch with QualityVbr fallback (target_quality: 0.6)
- Add EncodeFormat::Ogg variant (cfg-gated on vorbis-encode)
- Update ENCODE_EXTENSIONS and encode_format_for() to include .ogg
2026-11-14 10:02:09 -05:00
Dylan M. Taylor 53cc3c0f1a Merge pull request #1315 from storytold/sonar/s7688-bash-conditionals
scripts: test with [[ in fetch-opus-vectors.sh (SonarCloud S7688)
2026-11-14 10:00:27 -05:00
Dylan M. Taylor a207d20700 Merge pull request #1314 from AlexChambers/craft-raw/nikon-z6-z7-distortion
craft-raw: Nikon Z 6 and Z 7 in-file distortion; modes 1 and 3 only
2026-11-14 09:54:06 -05:00
Terra854 eec8408c53 fix: bound CR3 sample tables and accept supported RAF Bayer layouts 2026-11-14 22:47:42 +08:00