Commit Graph
3225 Commits
Author SHA1 Message Date
Dylan M. TaylorandSkaywalker eeae2bb7ca feat(ssip): extract bounded Speech Dispatcher wire helpers (#1500)
Adapted from WordCraft SSIP implementation; preserves contributor framing behavior while rejecting overlong complete lines.

Co-authored-by: Skaywalker <115165402+Skaywalker@users.noreply.github.com>
2026-11-16 09:55:17 -05:00
Dylan M. Taylor 9ac3245966 settings, atomic: give a replaced file's group bits only to its group (#558)
* settings, atomic: give a replaced file's group bits only to its group

write_backup copied the config's mode onto a new backup inode without
giving it the config's group, and craft-atomic's stage() did the same
for every replaced file: on a setgid directory or with another primary
group, the group bits opened the contents to a group never granted
them. Both now chown the new inode to the replaced file's group first
and drop the group bits when that fails.

* address review: skip fchown when the stage already has the replaced file's group

* atomic: route the stage's group change through AtomicFs so the fallback is tested
2026-11-16 09:55:13 -05:00
FredApps e2df3ce493 Merge pull request #1844 from storytold/feature/craft-unzip
craft-zip: Craft Anything's hardened ZIP reader as craft_zip::lenient
2026-11-16 15:52:03 +01:00
Dylan M. Taylor dd8f6b144f Merge pull request #1880 from storytold/fix/svg-writer-declaration-validation
fix(svg): validate XML declaration and DTD subset boundaries
2026-11-16 09:41:05 -05:00
FredApps c7a872e2f2 Merge pull request #1878 from storytold/onee/778-svg-guard-path
craft-svg: bound entity scans and reset smooth controls after Z
2026-11-16 15:13:24 +01:00
FredApps e60702ab1c Merge pull request #1861 from storytold/render-parity-harness
craft-render-parity: compare two renders against a stated tolerance (#587)
2026-11-16 15:02:00 +01:00
FredApps e836b6fd89 Merge pull request #1849 from storytold/feature/craft-macho
Add craft-macho: Mach-O slice tables and header names from Craft Anything
2026-11-16 14:46:00 +01:00
FredApps ceffcc52da Merge pull request #1846 from storytold/feature/craft-pe
Add craft-pe: PE/COFF headers from Craft Anything
2026-11-16 14:45:21 +01:00
FredApps 17afe46839 Merge pull request #1843 from storytold/feature/craft-tar
Add craft-tar: TAR and cpio member walkers from Craft Anything
2026-11-16 14:36:11 +01:00
Dylan M. TaylorandVoiceLessQ 6ef2c053df tiff: share allocation-free first-image compression probe (#1867)
* tiff: share WordCraft classic compression probe

Extracted from storytold/wordcraft crates/geom/src/picture.rs at fe8a8a838cde68b272ac68429e53049347feab40. Original implementation by VoiceLessQ; retains Dylan Taylor duplicate-tag hardening from ab0020d6f.

Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>

* tiff: cover compression probe refusal and endian parity

* test(tiff): allow assertions on bounded fixture conversions

---------

Co-authored-by: VoiceLessQ <t12kaem@gmail.com>
2026-11-16 08:19:29 -05:00
2f8b328c6f Add craft-elf: ELF program headers and dynamic entries from Craft Anything (#1851)
Moves the header pieces of Craft Anything's crates/formats/src/elf.rs
into a pure-Rust crate: the class/endian-aware reader, program_headers,
ProgramHeader, dynamic_entries, va_to_off, and the segment type,
permission and dynamic tag names. Mitigations, dynamic symbols, symbol
versions and core-file notes stay in the app.

Part of #778.

Co-authored-by: BFlat <bombayapirat@gmail.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
Co-authored-by: GGWA <65288322+rech4210@users.noreply.github.com>
2026-11-16 08:18:20 -05:00
Dylan M. TaylorandAndy Ching 046a7229af fix(docx): integrate VML fallbacks without breaking linked text-box stories (#1864)
* craft-docx: write Word 2010 shapes inside mc:AlternateContent with a VML fallback

A shape was written as a bare `wps:wsp` in `w:drawing`. Word 2007, and
Word 2000-2003 with the Office Compatibility Pack, don't know `wps` and
refuse the whole file. Word writes such shapes in `mc:AlternateContent`.

`write_shape` now guards the drawing with `mc:Choice Requires="wps"` and,
for rectangles, text boxes, rounded rectangles and ellipses, adds an
`mc:Fallback` with the shape as VML: size, position, z-order, wrapping,
fill, outline and the text box's text (copied from the choice's output,
so the story isn't written twice). Other kinds get no fallback; an old
reader skips that shape and still opens the file.

Refs storytold/wordcraft#6849

* craft-docx: guard a shape only when it gets a VML fallback; keep more in the fallback

A shape guarded by `mc:AlternateContent` with no fallback is skipped by
a reader that doesn't know `wps`, and dropped on that reader's next save:
worse than refusing the file. Such shapes are written bare again; only
shapes with a VML form are guarded.

The VML fallback also keeps the shape's own stacking order (a floating
object in its text box moved `self.z` on), its wrap distances, its hidden
flag and its text box's text direction.

* craft-docx: keep behind-text shapes' order in the VML fallback

A behind-text shape's fallback `z-index` was the negated `z`, which
reverses the order of overlapping behind-text shapes. It is now `z`
shifted below zero within signed 32-bit range, so a higher `z` still
stacks higher; other shapes' `z-index` is capped at `i32::MAX`.

* fix(docx): preserve linked text boxes without an incomplete VML fallback

---------

Co-authored-by: Andy Ching <53651198+andyching168@users.noreply.github.com>
2026-11-16 08:16:40 -05:00
FredApps dd345db898 image-codecs: read a raster's resolution from its headers (resolution_probe) (#1838)
* image-codecs: read a raster's resolution from its headers (resolution_probe)

file_resolution(bytes) gives the pixels per inch a JPEG, PNG, WebP, BMP or
classic TIFF records without decoding pixels. JPEG uses the decoder's marker
scan (Photoshop, XMP, EXIF, then JFIF), PNG reads pHYs as the decoder does and
falls back to eXIf, WebP its EXIF chunk, TIFF its IFD0 tags; BMP reads the
info header's pixels per metre. Values outside 1-100000 ppi count as none.

DesignCraft (crates/images/src/resolution.rs) and FigCraft
(crates/format/src/density.rs) each carry their own marker and chunk walkers
for this; they can switch to the shared probe.

Part of #778 and #785.

* image-codecs: resolution_probe reads only a whole nine-byte pHYs, and a zero one leaves eXIf

A pHYs chunk that declares any other length, or is cut off before its
CRC, records nothing, and its data is no longer read from the bytes
after it. A zero pixels-per-metre count records nothing either, as in the
decoder, so the eXIf resolution still answers.
2026-11-16 08:14:38 -05:00
FredApps af8981f596 craft-drawingml: chart legend entries and engineering-format rounding from DeckCraft (#792) (#1871) 2026-11-16 08:13:29 -05:00
FredApps becf2a0a55 svg: recognise rectangles, rounded rectangles and ellipses in scene paths (#778, #789) (#1869)
tree::primitive::recognize (and Path::primitive) returns the axis-aligned
basic shape a path draws: one closed contour whose points all lie on a
(rounded) rectangle's or ellipse's outline and that encloses its area. usvg
turns rect, circle and ellipse into paths; apps that edit them as shapes get
them back from the segments.
2026-11-16 08:07:44 -05:00
Dylan M. Taylor 21ceafea04 fix(svg): validate declaration encodings and internal subset boundaries 2026-11-16 07:59:10 -05:00
Dylan M. Taylor 1939018e7f fix: remove unused_workspace_dependencies lint (removed from rustc) (#1866) 2026-11-16 07:54:14 -05:00
FredApps 402dfe46ad raw: charge short lossy JPEG DNG strips their declared rows (craft-libs #778) (#1857) 2026-11-16 07:52:02 -05:00
FredApps 7888c863df svg: bound entity declaration scans and reset smooth controls after Z
#778, #789. Comments and CDATA are skipped, and a declaration name is
only scanned up to MAX_NAME+1, so a comment full of `<!ENTITYx` markers
is no longer a quadratic walk. Names longer than MAX_NAME are still
recorded so the expansion guard can refuse them. Closepath also clears
the smooth-control history, so S and T after Z start from the current
point rather than reflecting the pre-close control.
2026-11-16 13:51:42 +01:00
Dylan M. TayloranddotCooCoo a62de6c7c3 exr: integrate mixed deep/flat decoding with regression coverage (#1853)
* EXR: decode a flat part of a file that also holds deep parts

decode_part refused every part of a file with any deep part, and
decode_display_part, which checked only the selected part, still failed
because the exr crate's image reader validates every header and refuses
deep ones before it reads a chunk.

Both now decide from the selected part's own header. When any part is
deep, the selected flat part is read chunk by chunk: the flat headers are
validated, every part's offset table is walked from the end of the
headers, and only the selected table's chunks are read. A chunk must start
past the last offset table and inside the file, carry the selected part's
number and hold a block no other chunk of the part holds; anything else is
Malformed. Files with only flat parts keep the crate's reader.

The file-size ratio check, which was skipped for every part when any part
was deep, now applies to the flat parts of such a file; deep parts are not
counted.

* EXR: a flat part beside a deep part needs a chunk for each of its blocks

The chunk reader for a flat part of a file that also holds deep parts
refused only a second chunk for the same block. A tiled part's chunk that
named a level the part does not have was skipped without decompressing,
so the tile it took the place of had no chunk and the part decoded with
that tile left at zero.

Each chunk now has to hold one of the part's own blocks, taken from the
header, that no other chunk holds; anything else is Malformed. Since a
part has as many chunks as blocks, every block then has a chunk.

The mixed-file tests also run with a tiled flat part, and a new test
names a missing level and a repeated tile.

* EXR: a scan-line chunk beside a deep part must start at its block's first line

The block index of a scan-line chunk is its y offset divided by the
lines a block holds, rounded toward zero. A chunk whose y was not the
first line of a block, or lay up to 15 lines above the data window of
a ZIP part, still named a block and was decoded into it. Such a chunk
is now Malformed.

* EXR: a block too large to address is LimitExceeded instead of a panic

The exr crate bounds a flat chunk by a block's pixels times the bytes a
pixel takes, an unchecked product, before it reads the chunk. A 1 x 1
part with five float channels in 10^9 x 10^9 tiles passed every size
limit, and decode_part and decode_display_part then panicked with an
overflow, for files of flat parts only and for mixed files alike.
read_meta now computes the product with checked arithmetic for each
flat part and returns LimitExceeded when it does not fit in a usize.

* EXR: a chunk beside a deep part must fit the rest of the file

The exr crate allocates a chunk's declared payload, up to the size of a
block, before it reads it. In a mixed file whose flat part has large
tiles, a chunk declaring i32::MAX bytes made a 2 GiB allocation from a
file of a few hundred bytes. read_flat_part_chunks now reads the
declared length first and returns Malformed when it is longer than the
bytes left in the file.

* test(exr): verify mixed-part ratio and display block budgets

* fix(exr): bound mixed-part payload and block bookkeeping allocations

* fix(exr): expose internal ordinal helpers to regression tests

---------

Co-authored-by: dotCooCoo <RobertLeeLW@gmail.com>
2026-11-16 07:47:06 -05:00
FredApps 7ed3163f35 render-parity: a NaN tolerance fails its check instead of switching it off 2026-11-16 13:45:33 +01:00
FredApps 8e03cd016d craft-pdf: content streams (parse, serialize, matrices) from PDFCraft (#1852)
Adds the content feature and cos::content: PDFCraft's crates/content, moved
here so other apps can read and write page content streams. The parser keeps
operator spans, skips and counts unreadable bytes, and keeps inline images
whole; tests move with it.

Refs #778
2026-11-16 07:30:09 -05:00
FredApps 083920ebd7 psd: keep a layer record's blocks before an overlong one (#1845) 2026-11-16 07:19:08 -05:00
FredApps a80c0f25f1 ps: add a write feature for PostScript tokens (#778, #790) (#1840)
* ps: add a write feature for PostScript tokens

Numbers, strings, matrices, path data and Flate, so apps can emit a
PostScript or EPS program without owning the token serializer. Path and
paint operators can use the Language Reference names or the one-letter
names a bound prolog defines. Container concerns stay in craft-eps.

Part of #778 and #790.

* ps: tighten write-feature number trimming and Flate bounds

- Require flate2 1.1.10 so inflate rejects an incomplete zlib stream.
- Trim trailing zeros only when the token has a decimal point, so
  places=0 keeps integer zeros at the 1e15 boundary.
- Use saturating_add when bounding inflate, so max = u64::MAX does not
  overflow.
2026-11-16 07:12:00 -05:00
FredApps ddbe78231b craft-video: pass the packet's Adobe APP14 transform to the MJPEG decoder (#1847)
mjpeg::Decoder called craft_jpeg::decode with no Adobe transform, so a
packet with numeric component ids and APP14 transform 0 (RGB as stored)
was converted as YCbCr and came out in the wrong colours. The decoder
now reads the transform with craft_jpeg::adobe_transform, as the JPEG
image readers do. A regression test injects APP14 transforms 0 and 1;
it fails without the fix.
2026-11-16 07:10:48 -05:00
FredApps 431f704478 svg: let SvgWriter name the encoding and write a DOCTYPE subset (#778, #789) (#1842)
* svg: let SvgWriter name the encoding and write a DOCTYPE subset

VectorCraft's SVG document wrapper needs a Latin-1 declaration and a
<!DOCTYPE svg [ <!ENTITY …> ]> internal subset, including a minified
form with no extra newlines. The existing declaration was UTF-8 only,
and craft-xml's doctype helper writes only <!DOCTYPE name>.

Part of #778 and #789.

* svg: expose SvgWriter::as_str for a second pass on open markup

A consumer that rewrites character references or hashes the document
around a metadata element needs the text of an unclosed root. finish()
would close it first.
2026-11-16 07:04:35 -05:00
FredApps 9f46880bf5 Merge remote-tracking branch 'origin/main' into w1849
# Conflicts:
#	Cargo.toml
#	README.md
2026-11-16 13:01:00 +01:00
FredApps 48dcd1b472 Merge remote-tracking branch 'origin/main' into w1846
# Conflicts:
#	Cargo.toml
#	README.md
2026-11-16 13:00:41 +01:00
FredApps 57f94d5283 Merge pull request #1834 from andyching168/docx/wps-shape-vml-fallback
craft-docx: write Word 2010 shapes inside mc:AlternateContent with a VML fallback
2026-11-16 13:00:13 +01:00
FredApps 356c7ceb29 Merge remote-tracking branch 'origin/main' into w1843
# Conflicts:
#	Cargo.toml
#	README.md
2026-11-16 12:59:40 +01:00
FredApps b836a71856 craft-svg: a paths feature, and CSS colours with their alpha (#1848)
The geometry reader (craft_svg::paths) is the only part of the crate that
needs vectorcraft-geom and vectorcraft-pathops, and the tree is the only part
that needs craft-image-codecs. Both are now optional: paths is a default
feature and tree turns it on, so existing users build the same crate, while
an app that only needs SVG text, guards, path data, colours and the writer can
turn default features off and take no app crates or image codecs.

parse_color_alpha is parse_color keeping the alpha of #rgba, #rrggbbaa and
the fourth value of rgb()/hsl(). parse_color now calls it and still drops it.

Refs #778, #789
2026-11-16 06:54:06 -05:00
Dylan M. Taylor e409e74333 fix(print): opt-in bounded discovery for larger CUPS fleets (#1734)
* fix(print): allow explicitly bounded fleet discovery

* print: frame fleet discovery fixture as an HTTP reply
2026-11-16 06:49:02 -05:00
FredApps 070005125f Add craft-sniff: name a file's format, media type and extension from its first bytes (#1841) 2026-11-16 06:38:32 -05:00
FredApps 99e0f2be89 render-parity: compare two renders against a stated tolerance (#587) 2026-11-16 12:34:01 +01:00
FredApps 712feab586 craft-zip: the lenient reader as craft_zip::lenient instead of a second ZIP crate
craft-unzip's raw-bytes reader moves unchanged into craft-zip as the
`lenient` module, behind the `lenient` feature (DEFLATE) and
`lenient-bzip2`, `lenient-lzma` and `lenient-zstd` for the other
methods, with `serde` for the listing types. craft-zip's default build
is unchanged; the module doesn't use the `zip` crate. Its unit and
integration tests move with it and run in craft-zip's test build.
2026-11-16 12:25:00 +01:00
FredApps 44d83fa8f6 Merge pull request #1323 from keithcsqueensu/xlsb-sizes
craft-xlsx: read row heights, column widths and default sizes of a binary sheet
2026-11-16 12:18:18 +01:00
FredApps eafb50aff3 Merge pull request #1653 from storytold/codex/dng-opcode-interpreter
Parse DNG opcode parameters into typed values
2026-11-16 12:03:21 +01:00
FredApps 806fa9a5a0 Merge pull request #1648 from storytold/codex/dng-capture-info
Share CinemaDNG capture metadata parsing
2026-11-16 12:02:33 +01:00
Dylan M. Taylor 37124f86d7 feat: add craft-mcp-server (JSON-RPC 2.0 MCP protocol) (#1649)
* feat: add craft-mcp-server (JSON-RPC 2.0 MCP protocol)

Port from solidcraft: MCP server machinery any app may share,
independent of transport and tools.

- JSON-RPC 2.0 over stdio (newline-delimited)
- MCP lifecycle: initialize, initialized, ping, notifications
- Tools: register, list, call with schema validation
- Resources: register, list, get by URI or template
- Prompts: register, list, get with argument completion
- Content blocks: text, image (base64), progress tokens

No external dependencies beyond serde_json.
Follows craft-libs safety pattern: #![deny(clippy::unwrap_used, ...)]

* retrigger CI

* retrigger CI

* Record MCP server dependencies in workspace lockfile

* chore: update rustls-webpki 0.103.15→0.103.16 and zip 9.1.0→9.1.3
2026-11-16 06:02:29 -05:00
FredApps 5ff3dd85b8 Merge pull request #1647 from storytold/codex/dng-metadata
Share bounded DNG processing and camera metadata
2026-11-16 11:56:50 +01:00
65848bfe29 Add craft-macho: Mach-O slice tables and header names from Craft Anything
Moves the header pieces of Craft Anything's crates/formats/src/macho.rs
into a pure-Rust crate: fat_slices (fat and fat64), FatSlice, cpu_name,
load_command_name, load_command_min_size, nibble_version and
unixthread_pc. The load command walker, symbols, stubs and Objective-C
metadata stay in the app.

Part of #778.

Co-authored-by: Afloat <ShuffleMonkey@163.com>
Co-authored-by: BFlat <bombayapirat@gmail.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
Co-authored-by: Cr <60964294+Chr0mium24@users.noreply.github.com>
Co-authored-by: GGWA <65288322+rech4210@users.noreply.github.com>
2026-11-16 11:47:05 +01:00
Dylan M. Taylor 731c4f262a Merge pull request #1758 from dotCooCoo/fix/exr-deep-part-tables-end
craft-exr: deep chunk offsets start after every part's offset table
2026-11-16 05:46:49 -05:00
Dylan M. Taylor 8a83e9178d Merge pull request #1837 from ljkx/image-codecs-bmp-resolution
image-codecs: BMP keeps its resolution in the header's pixels per metre
2026-11-16 05:45:26 -05:00
FredApps a8d29a8779 craft-pe: give the header reader its own field helper 2026-11-16 11:44:25 +01:00
4123d1235b Add craft-pe: PE/COFF headers from Craft Anything
Moves the header half of Craft Anything's crates/formats/src/pe.rs into
a pure-Rust crate: PeHeaders/PeSection, headers, has_pe_header,
subsystem_name, rich_header, the data-directory names and the RVA
mapping helpers. The import, export, resource and program-model code
stays in the app for now.

Part of #778.

Co-authored-by: Afloat <ShuffleMonkey@163.com>
Co-authored-by: BFlat <bombayapirat@gmail.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
2026-11-16 11:43:48 +01:00
ecc89eccff Add craft-unzip: Craft Anything's hardened ZIP reader
Moves Craft Anything's crates/formats/src/zip.rs, zip_file.rs and the
entry decoders from decompress.rs into a pure-Rust crate, keeping the
R3.12 hardening: directory and extra-field bounds, ZIP64 end-record
recovery after a prepended stub, multi-volume refusal, CRC-checked
Info-ZIP Unicode Path names, decoded-size and CRC-32 checks.

bzip2, LZMA/XZ and Zstandard entry methods sit behind default features;
Serialize sits behind an optional serde feature.

Part of #778.

Co-authored-by: Afloat <ShuffleMonkey@163.com>
Co-authored-by: BFlat <bombayapirat@gmail.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
Co-authored-by: GGWA <65288322+rech4210@users.noreply.github.com>
Co-authored-by: Max Mittelstädt <62167861+TheGalitube@users.noreply.github.com>
Co-authored-by: NetterSilver <133535268+Silvertree2010@users.noreply.github.com>
Co-authored-by: RRFZ <247457381+Plastic-time@users.noreply.github.com>
Co-authored-by: Roman Serikoff <serikoff@li.ru>
2026-11-16 11:40:58 +01:00
d25dcc5773 Add craft-tar: TAR and cpio member walkers from Craft Anything
Moves Craft Anything's crates/formats/src/tarcpio.rs (main 090188d7) into a shared crate with
its unit tests, the TAR integration tests from crates/formats/tests, and the archive builders
those tests use. The public API is unchanged; CpioChecksum and cpio_with_checksum become public
so the app's firmware scanner can keep sharing its checksum allowance. The pax record handling
is split out of the walker (same checks, same warnings) to stay under the workspace's
cognitive-complexity limit. Serialize is behind an optional `serde` feature.

Co-authored-by: Brandon Thomas <echelon@gmail.com>
Co-authored-by: Afloat <ShuffleMonkey@163.com>
Co-authored-by: BFlat <bombayapirat@gmail.com>
Co-authored-by: RRFZ <247457381+Plastic-time@users.noreply.github.com>
Co-authored-by: NetterSilver <133535268+Silvertree2010@users.noreply.github.com>
2026-11-16 11:30:54 +01:00
FredApps 341020b2c1 Merge pull request #1757 from el-j/feat/video-mjpeg
craft-video: Motion JPEG decoder and encoder (mjpeg)
2026-11-16 11:18:40 +01:00
FredApps 9b87ff0a0e raw: dng_metadata checks the LinearizationTable count before reading its entries 2026-11-16 10:34:00 +01:00
FredApps 57288edafd Merge pull request #1693 from storytold/codex/edl-bounded-report
Support bounded EDL parse diagnostics
2026-11-16 10:33:09 +01:00