Commit Graph
3834 Commits
Author SHA1 Message Date
Diego Chagas 7ff0f967db image-codecs: read JPEG XL through craft-jxl behind a jxl feature (#2135)
* image-codecs: read JPEG XL through craft-jxl behind a jxl feature

Format::Jxl reads when the non-default `jxl` feature is on (decode only, so the
encoder's jixel dependency is not built); without it JPEG XL is still detected and
opening one is an Unsupported error that says the build lacks it. Orientation is
applied by the decoder, so the Exif and XMP orientation become 1. ICC, Exif and XMP
come through; associated alpha is divided out; float files open as F32.

* image-codecs: skip JPEG XL in the one-pixel round trip

The encoder refuses images narrower than two pixels; with the jxl feature JPEG XL is a
read-and-write format, so the generic round trip reached it.
2026-11-18 15:26:57 -05:00
Diego Chagas f57bbca24f jxl: bound brob metadata boxes before jxl-oxide inflates them (#2134)
jxl-oxide decompresses brob (Brotli Exif/XMP) boxes into a buffer its AllocTracker
does not count, so a 54-byte box expanded to 64 MiB of XMP and a larger one can ask for
gigabytes before any pixel limit applies. decode now inflates every brob box under one
8 MiB budget per file, rewrites it as the plain box it wraps and drops boxes past the
budget, nested or broken ones. Files without a brob box are not copied.
2026-11-18 15:25:26 -05:00
DJHoltkampandDJHoltkamp 0d8d8b9091 craft-image-codecs: refuse WebP animation frames that would panic image-webp (#2263)
For an animation frame that starts with an `ALPH` chunk, image-webp 0.2.4 decodes
the next chunk as VP8 whatever its FourCC, skips the size check it makes for frames
without alpha, and indexes the frame's buffers by the picture's own size. A picture
larger than its `ANMF` header, or a non-key frame (decoded as 0x0), panicked with
out-of-bounds indexing in `read_frame` and `fill_rgba`. image-webp also steps from one
frame to the next without the padding byte, so after an odd-sized `ANMF` chunk it
reads the next frame one byte early.

Before decoding, the container is walked for the first frame with alpha whose picture
is not a VP8 key frame of its header's size, and for the first odd-sized `ANMF` chunk.
That frame is refused like a damaged frame: `decode` (which reads frame 0) errors only
when it is the first, and `decode_webp_frames` keeps the frames before it with a
`Truncated` warning.

Found by fuzzing `decode_webp`; ported from storytold/photocraft#10473, which was
written before PhotoCraft's codecs moved here. The regression test panics without the
fix.

Co-authored-by: DJHoltkamp <4955429+DJHoltkamp@users.noreply.github.com>
2026-11-18 15:24:26 -05:00
Hamza Naveed bd5c93cf50 craft-odf: taking inline items out of a flat document is linear (#2219) (#2237)
take_out searched the whole rest of the document for the next picture and the next inline
object on every item, so a document with many of one kind and none (or few) of the other cost
items × size. It now keeps where the next of each is and searches for a kind again only once
it has been passed. The output is the same.
2026-11-18 15:23:21 -05:00
82fc745154 image-codecs: PNG bounds its image on the IDAT data and reserves only what it can make (#2231)
* image-codecs: PNG bounds its image on the IDAT data and reserves only what it can make (lightcraft#3912)

The plausibility check measured the stored samples against the whole file
length, so ancillary chunks lifted the bound, and the decoder then reserved
the whole expanded output up front. A 1-bit 20000x20000 image is 50 MB
stored but 400 MB to 1.6 GB once expanded to 8-bit grey, RGB or RGBA, so
about 60 KB of IDAT reserved gigabytes.

- Bound the stored samples on the bytes of the first IDAT run (1032:1 plus
  1 MiB), not the file length.
- Reserve up front only what the IDAT data can inflate to; past that, grow
  the buffer as rows decode, at most doubling and never past the full
  output. A forged file fails on its first row; a real solid or sparse
  1-bit image that is past the ratio once expanded still decodes.
- Interlaced images decode into the whole zero-filled output in one go,
  so their expanded size is checked against the IDAT data.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fnx9MwPUug72xHRgg993uc

* Fix Adam7 palette expansion bounds without allocating unvalidated output

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
2026-11-18 15:14:45 -05:00
Phil HartandClaude Opus 5.5 2393b1f16f craft-raw: decode two-field Coolpix NEFs (E5400, E5700 CYGM, E8400, E8800) (#2235)
Ported from storytold/lightcraft#672, whose decoder code now lives here.
Some CCD Coolpix bodies store two interlaced fields one after the other in
one tight 12-bit strip. For the measured bodies, in their measured legacy
layout (binary maker-note version 0.2.0.0, compression 1, one strip of
w*h*1.5 bytes), the fields are interleaved in the model's field order. The
E5700's CYGM mosaic becomes approximate linear RGB with fixed gains.
Masked columns are judged on the stored rows, so the header probe and the
full decode agree. Other files keep their stored rows.

Checked on 527 NEF/NRW samples: only the six E5400/E5700/E8400/E8800 files
(and four synthetic legacy-layout fixtures) change; the other 517 decode
bit-identically.


Claude-Session: https://claude.ai/code/session_01Fnx9MwPUug72xHRgg993uc

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 15:03:26 -05:00
Phil HartandClaude Opus 5.5 0976e3fd19 craft-raw: Kelvin presets for more CR2, CR3, PEF and RW2 raws (#2234)
Reads the camera's white-balance presets as a Kelvin curve where the
decoders gave none:
- CR2 ColorData versions 1 to 12 (5-word records), version 10 at either
  of its two layouts, picked by the Daylight record's 5200 K;
- CR3 ColorData versions 16-19, 32-34, 48 and 64-66;
- PEF maker note 0x0221 (entries of 53190 - K and the red/blue
  multipliers);
- RW2/RWL/RAW tag 0x0027: the D55 and 3200 K studio tungsten
  multipliers as a neutral pair with their chromaticities
  (KelvinPresets::from_neutral_lights / neutral_lights).
Ported from storytold/lightcraft#2527.


Claude-Session: https://claude.ai/code/session_01Fnx9MwPUug72xHRgg993uc

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 15:02:12 -05:00
Phil HartandClaude Opus 5.5 ccabfee3b5 craft-raw: no frame floor for tiny lossless JPEG tiles (#2232)
A DNG tile's frame may hold at most twice the tile's samples and a Sony
quad tile's at most the tile's samples, with no 65,536-sample floor. The
floor let each of many tiny tiles decode and keep a frame far larger than
the tile budget counts (storytold/lightcraft#4024). A DNG tile also drops
the surplus capacity of a larger frame after the resize.


Claude-Session: https://claude.ai/code/session_01Fnx9MwPUug72xHRgg993uc

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 15:00:30 -05:00
Dylan M. Taylor 2466fd7ad8 Reject nonfinite promoted PostScript decimal integers (#2256) 2026-11-18 14:05:54 -05:00
FredApps 62f7a7e477 Merge pull request #2244 from FredApps/fix/786-psd-tysh-prefix
psd: expose bounded raw TySh text prefix
2026-11-19 01:29:20 +07:00
FredApps a7ff7b31ae Merge pull request #2241 from FredApps/fix/786-psd-section-recovery
psd: add opt-in section-divider blend recovery
2026-11-19 01:29:08 +07:00
David Mann 453210d8d0 Merge pull request #1122 from davidmann4/craft-flags-review
fix(flags): the review findings on craft-flags (#1119)
2026-11-18 19:29:05 +01:00
David Mann 9824f9e009 Merge pull request #2199 from davidmann4/repin-craft-ai-agents
Pin craft-ai-agents to a commit on craft-ai-integrations main (#2198)
2026-11-18 19:28:35 +01:00
FredApps 44086e9c58 Merge pull request #2206 from FredApps/fix/786-psd-vector-records
psd: expose path record knot decoding for consumer adapters
2026-11-19 01:06:18 +07:00
Dylan M. Taylor f4b5fdebc1 Exercise valid delegated OCSP evidence and isolated rejection policies (#2249) 2026-11-18 12:36:15 -05:00
David Mann 1d5ac4ba5c Merge remote-tracking branch 'origin/main' into HEAD 2026-11-18 18:24:33 +01:00
David Mann 679a499cc6 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	Cargo.toml
2026-11-18 18:24:12 +01:00
Dylan M. Taylor bc4aae37bb Merge pull request #2245 from storytold/fix/ocsp-certificate-wrapper-20261118
fix(pkcs7): read standard OCSP certificate sequence wrappers
2026-11-18 12:12:13 -05:00
Dylan M. Taylor c51ed21b27 Merge pull request #2162 from storytold/fix/html-widthless-colgroup
craft-html: preserve cell-width fallback for widthless colgroups
2026-11-18 11:52:59 -05:00
FredApps 9af6a8e4a1 Merge remote-tracking branch 'origin/main' into fix/786-psd-tysh-prefix 2026-11-18 17:40:01 +01:00
FredApps d04bd2c4fb Merge remote-tracking branch 'origin/main' into fix/786-psd-section-recovery 2026-11-18 17:40:00 +01:00
FredApps 8ea89705a5 Merge main to inherit full Windows formatting repair 2026-11-18 17:39:45 +01:00
FredApps 1564b02263 Merge pull request #2208 from FredApps/ci/full-format-packages-778
ci: retain full Windows formatting with package-sized calls
2026-11-18 23:37:52 +07:00
FredApps 1063b59726 psd: expose bounded raw type-layer text prefix 2026-11-18 17:37:25 +01:00
Dylan M. Taylor f589ff4857 Merge pull request #2039 from agstrc/craft-raw-sony-zv-e10-distortion
craft-raw: Sony ZV-E10 in-file distortion
2026-11-18 10:58:33 -05:00
Dylan M. Taylor efce830a55 Merge pull request #2042 from techneissa/fix/2040-dng-strip-active-width
craft-raw: a DNG strip whose byte count is only ActiveArea wide is read in full, not refused
2026-11-18 10:57:42 -05:00
FredApps 8df7c0268a psd: expose recovering section-divider blend reader 2026-11-18 16:36:52 +01:00
FredApps 23acc70493 Merge pull request #2055 from storytold/feat/xfa-xml-dom
Add shared XFA namespace-aware XML DOM
2026-11-18 21:53:41 +07:00
Dylan M. Taylor 35afed3956 Merge pull request #2046 from storytold/feat/dex-reader
Add shared Dalvik DEX reader and bytecode decoder
2026-11-18 09:46:50 -05:00
FredApps d95c29f5ab Merge remote-tracking branch 'origin/main' into ci/full-format-packages-778 2026-11-18 15:36:05 +01:00
Dylan M. Taylor 3f367fd710 Merge remote-tracking branch 'storytold/main' into feat/dex-reader 2026-11-18 09:17:09 -05:00
Dylan M. Taylor 7a7a18cb40 Merge pull request #2188 from chasse20/mcmat-v3
Publish MCMAT v3 as a portable procedural source archive
2026-11-18 08:32:32 -05:00
Dylan M. Taylor 74b198524b fix(zip): preserve named read error contracts 2026-11-18 07:47:03 -05:00
FredApps 4d2784ec90 psd: use fixed-size chunks in vector record fixture 2026-11-18 13:38:03 +01:00
David Mann c435b8dff0 Merge branch 'main' into repin-craft-ai-agents 2026-11-18 13:36:43 +01:00
David Mann ccbc4b756c Merge pull request #2202 from davidmann4/ci-fmt-skip-windows
ci: skip cargo fmt on the Windows lint leg (#2200)
2026-11-18 13:33:00 +01:00
FredApps 83131112ab Decode Cargo metadata as UTF-8 on Windows 2026-11-18 13:26:52 +01:00
FredApps ce732d2b8b ci: preserve full Windows formatting with package-sized invocations 2026-11-18 13:25:09 +01:00
FredApps a557fed94e psd: expose path record knot decoding for consumer adapters 2026-11-18 13:15:03 +01:00
David MannandClaude Opus 5.5 1cc156dcc3 ci: skip cargo fmt on the Windows lint leg (#2200)
One rustfmt call with every source root of the workspace is now longer
than a Windows command line may be (os error 206). rustfmt's result is
the same on every system; the Linux and macOS legs keep checking it.
The lint-command guard states the per-system stages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 12:43:50 +01:00
FredApps 06180c1a3f Merge pull request #2161 from FredApps/fix/786-psd-placement-parity
psd: preserve bounded placement and descriptor compatibility
2026-11-18 18:36:37 +07:00
Dylan M. Taylor abde74fa7d fix(mcmat): validate manifests and read resources by index 2026-11-18 06:33:33 -05:00
David MannandClaude Opus 5.5 8bcdc60584 Pin craft-ai-agents to a commit on craft-ai-integrations main (#2198)
35e0352666 is the head of a deleted, squash-merged branch and is
reachable only through its pull request ref. d94a3593ad is main's head.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 12:32:52 +01:00
David Mann bc3cbc7edc Merge pull request #2142 from davidmann4/agents-live-client
MCP move shared code from PhotoCraft to craft-libs (#2141)
2026-11-18 12:19:07 +01:00
Dylan M. Taylor 486319f5ff fix(dex): retain reference-query parse incompleteness 2026-11-18 05:18:38 -05:00
FredApps e1fc4b1376 psd: annotate quilt policy test closure parameter 2026-11-18 10:39:08 +01:00
FredApps 01ffc9fbc7 Merge pull request #661 from wdunn001/craft-esign-upstream
craft-esign: e-sign contracts and the request-signatures dialog
2026-11-18 16:19:16 +07:00
FredApps 711bb1afcb Merge pull request #557 from totoz64/feat/french-language-pack-proofing
Proofing: add French pack rules and regional typography
2026-11-18 16:18:13 +07:00
FredApps d78a99a0a7 psd: validate explicit bounds in unsliced quilt context 2026-11-18 10:10:41 +01:00
FredApps c9862964df psd: require complete numeric explicit quilt bounds 2026-11-18 09:38:28 +01:00