Commit Graph
2036 Commits
Author SHA1 Message Date
alehel e1e17af671 test(media): VMD frame as high as the picture but not as wide
Review round 3 found no defect; this closes the one placement case the
unit test did not pin.
2026-11-15 01:50:28 +01:00
alehel fcfb66d0c2 fix(media,video,audio): VMD review round 2
- media: correct round 1's frame placement. The picture's position is
  not one value for a file: it starts at the screen's corner and a
  frame with data that is as large as the picture and not at the corner
  moves it for the frames that follow, as ffmpeg was seen to do.
  `picture_rect` now takes the frame's index; `origin()` is gone.
- audio: unknown frame flags are refused for an empty frame too.
- video: count the unpack buffer in the picture budget.
- docs: which sound frames are bounded by what, which cut-short blocks
  are errors, and why sound needs both the flag and a rate.
- tests: ffmpeg's placement cases, the size of the LZ stop, multi-block
  16-bit stereo frames, and an LZ test that compared half its picture.
2026-11-15 01:50:28 +01:00
alehel 75badac3b6 fix(media,video,audio): VMD review round 1
- media: place video frames by the first frame as large as the picture,
  not by the header's position fields, as ffmpeg was seen to do; a
  frame outside the picture has no rectangle.
- media: a file has sound only with the header flag and a sample rate.
- video: stop LZ unpacking at what a picture can use, so a frame's cost
  no longer goes by a length the file states.
- audio: a flags 1 sound frame plays every whole block it holds.
- docs: how sound lines up with pictures, what the buffer count is, and
  which cut-short blocks are errors.
- tests: the frame-count cap, the 0xFF tag near the end of LZ data,
  palette components over 6 bits, the error conversion and the new
  identifiers.
2026-11-15 01:50:28 +01:00
alehel 6ac5f83bb2 feat(media,video,audio): add Sierra VMD demuxer and decoders
Sierra VMD (Video and Music Data) is the video format of Sierra and
Coktel Vision games of the 1990s. Written clean-room from the public
format description at https://wiki.multimedia.cx/index.php/VMD, with
ffmpeg as a black-box oracle.

- craft-media: `vmd` feature, a demuxer for the 816-byte header and the
  table of contents; `Container::Vmd`, `CodecId::VmdVideo` and
  `CodecId::VmdAudio`.
- craft-video: `vmd` feature, a decoder for 8-bit paletted pictures
  (rendering methods 1 to 3, LZ packing, palette changes).
- craft-audio: `vmd-decode` feature, a decoder for 8-bit PCM and 16-bit
  DPCM sound, mono and stereo.
- craft-media-testkit: a VMD fixture writer, since ffmpeg reads VMD but
  cannot write it.

Tests compare the decoders with ffmpeg on generated files, and on real
files when CRAFT_MEDIA_VMD_SAMPLES names a directory of them. 16-bit,
24-bit and Indeo 3 pictures, IMA ADPCM sound and the later header
revisions are not decoded.
2026-11-15 01:50:28 +01:00
Dylan M. Taylor d6cd7836d3 feat(video,image-codecs,stream-codecs): add encode_with_key, encode_avif_hdr, and decode_ccitt_raw (#1369) 2026-11-14 16:15:44 -05:00
Dylan M. Taylor 712b0f792e Merge pull request #1361 from storytold/sec/psd-length-refusal
craft-psd: pin that a length not fitting 32 bits is refused, not truncated
2026-11-14 15:57:56 -05:00
Dylan M. Taylor 30209caad8 feat(gif,image-codecs): add indexed/interlaced GIF, jpeg_progressive_scans, and JP2 decode (#1358)
* feat(gif,image-codecs): add indexed/interlaced GIF, jpeg_progressive_scans, and JP2 decode

* chore: update Cargo.lock for craft-image-codecs jp2 dep

* fix(image-codecs,svg): deref jp2 ch and re-export resvg from craft_svg::tree::draw
2026-11-14 15:13:21 -05:00
Dylan M. Taylor fae9569718 craft-docpath: prove a multi-megabyte UNC path parses iteratively 2026-11-14 14:53:16 -05:00
Dylan M. Taylor 25abb43bde craft-psd: pin that a length not fitting 32 bits is refused, not truncated 2026-11-14 14:44:05 -05:00
Dylan M. Taylor 5a457dda6a Merge pull request #1341 from storytold/sec/pdf-no-rc4-create
craft-pdf: refuse to create RC4 encryption without an explicit legacy call
2026-11-14 14:43:13 -05:00
Dylan M. Taylor 9d9cd81013 Merge pull request #1344 from storytold/codex/pdfx1a-review-hardening
fix(prepress): address PDF/X review findings
2026-11-14 14:41:49 -05:00
Dylan M. Taylor cbf6ea8584 Merge pull request #1335 from storytold/codex/xml-dtd-review-hardening
fix(xml): address DTD validator review findings
2026-11-14 14:41:44 -05:00
Dylan M. Taylor 3a8797a7f4 Merge pull request #1345 from storytold/sec/dwg-fail-closed
craft-dwg: refuse to convert without a worker instead of running acadrust in-process
2026-11-14 14:22:47 -05:00
Dylan M. Taylor c6221e42ff Merge remote-tracking branch 'storytold/main' into sec/pdf-no-rc4-create
# Conflicts:
#	crates/pdf/src/crypt/tests.rs
2026-11-14 13:47:06 -05:00
Dylan M. Taylor 75a654f4f8 craft-pdf, craft-pkcs7: compare password-derived verifiers without an early exit (#1340)
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).
2026-11-14 13:45:48 -05:00
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
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
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
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
Dylan M. Taylor f5720d8f69 refactor(xml): share bounded tree-node validation 2026-11-14 17:36:14 +00:00
Dylan M. Taylor bac1a19d93 fix(xml): harden DTD validation bounds and parsing 2026-11-14 17:10:03 +00: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 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
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
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 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 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
Dylan M. Taylor bfea7d9800 Merge pull request #1317 from storytold/codex/jpeg-cmyk-app-compat-official
Preserve unmarked CMYK JPEG sample polarity
2026-11-14 09:38:51 -05:00
Naxvog 5f67d91eee craft-docx: a file with no default table style gives its tables no cell margins
Port of storytold/wordcraft#3821, whose reader code moved here with storytold/wordcraft#6603. Word's 0.08" cell margin comes from the Normal Table default table style; without a default table style a table that sets no margins (and whose style sets none) has zero margins. The zeros are kept as the table's own, also for the old properties of a tblPrChange, so they survive saving. w:default="on" now marks a default style too.
2026-11-14 15:27:22 +01:00
Dylan M. Taylor cebc847ba8 Merge pull request #1320 from storytold/codex/docx-normal-default-official
Respect default Normal styles in DOCX
2026-11-14 09:21:31 -05:00
Zinadin Zidan 45a8e16669 craft-midi: say when a lenient read left part of a file out at a limit (#1308)
read_smf_lenient keeps what comes before MAX_EVENTS events or MAX_TRACKS
tracks and only says so in a warning. Those warnings are words, and at
most MAX_WARNINGS of them are kept: when earlier damage has filled them,
nothing tells the caller that the file was cut.

LenientRead gets over_limit, set whenever either limit left something
out, full warnings or not. A caller that refuses over-limit files, as
read_smf does, can now do so after a lenient read. LenientRead is
non_exhaustive, so the new field breaks no caller.
2026-11-14 15:20:22 +01:00
midasmatterhorn 08c206f4ae Merge remote-tracking branch 'upstream/main' into r4-print-shrink-147 2026-11-14 16:55:58 +03:00
Dylan M. Taylor 8ef708255e test(jpeg): cover unmarked CMYK craft decoding 2026-11-14 13:39:46 +00:00
Trevor Brown 25d56bb49c Merge upstream/main into fix/web-jpeg-oversized-xmp 2026-11-14 08:32:33 -05:00
Dylan M. Taylor 8097ede0ff Resolve DOCX migration conflict with current main 2026-11-14 13:29:23 +00:00
Dylan M. Taylor 8f3247882d Fix unmarked CMYK polarity on craft JPEG path 2026-11-14 13:26:52 +00:00
Dylan M. Taylor 6d19bb44f3 fix(docx): preserve Normal inference compatibility 2026-11-14 13:25:25 +00:00
Dylan M. Taylor 6beefd7e95 fix(wordmodel): mark Normal as default in new documents 2026-11-14 13:25:25 +00:00
Dylan M. Taylor 31f4185fa5 test(docx): preserve explicit Normal-off serialization 2026-11-14 13:25:25 +00:00
Dylan M. Taylor 90d20fd39f fix(docx): keep default Normal for fresh documents 2026-11-14 13:25:25 +00:00
Dylan M. Taylor 00fdde1f06 docx: retain explicit nondefault Normal on write 2026-11-14 13:25:25 +00:00