Commit Graph
3938 Commits
Author SHA1 Message Date
Dylan M. Taylor 08da5e1486 anicraft-format: add write_version for explicit envelope version (#2420) 2026-11-19 14:00:33 -05:00
Dylan M. Taylor 8dbe9705ff psd: detect Lr16/Lr32 and Mt* merged transparency in Merged::open (#2412) 2026-11-19 13:11:21 -05:00
Dylan M. Taylor 5d422c4f9d zip: add symlink detection and streaming writer destinations (#2411)
* zip: add symlink detection and streaming writer destinations

* Reject legacy UTF-8 mode from generic ZIP finish_into
2026-11-19 13:11:18 -05:00
Dylan M. Taylor 41a9edd001 image-codecs: keep resolution probe fallback and container-only WebP EXIF scan (#2409) 2026-11-19 13:11:14 -05:00
aiongg ae0b772337 Merge pull request #2402 from aiongg/ci-keep-workspace-crates
ci: the Workspace gate keeps compiled workspace crates on its Linux leg
2026-11-19 12:53:45 -05:00
Dylan M. Taylor b041cd8224 Merge pull request #2407 from storytold/fix/svg-path-data-quads
svg: add parse_path_with_quads preserving quadratic segments
2026-11-19 12:40:00 -05:00
Dylan M. Taylor 5c496f6e96 zip: add SeekableArchive streaming reader and seekable entry-count guard (#2406) 2026-11-19 12:27:57 -05:00
Dylan M. Taylor 45da77942b svg: add parse_path_with_quads preserving quadratic segments 2026-11-19 11:52:55 -05:00
aiongg 7a040c1f3b ci: the Workspace gate keeps compiled workspace crates on its Linux leg
The Linux leg restores the newest rolling cache entry of the workspace
crates (cache-workspace-crates), so a pull request rebuilds only the
crates its change reaches. Each main run saves an entry of its own and
cache-prune deletes the older ones; the midnight scheduled run builds from
source and starts the entry afresh.

gate.yml's cache-workspace-crates covers a whole call, so the macOS and
Windows legs move to a call of their own with dependency-only entries. A
select platforms job decides whether that call runs, since an empty leg
list would fail it.

To fit the 10 GB cache budget, the lint legs and the sonarcloud
instrumented build keep no cache.
2026-11-19 16:02:38 +00:00
Dylan M. Taylor d7c9632bfb image-codecs: add jpeg_with_icc and jpeg_without_icc to jpeg_inks (#2400) 2026-11-19 10:53:18 -05:00
Dylan M. Taylor 48c57b5faf http-url: add parse_content_range (#2395) 2026-11-19 10:00:32 -05:00
Dylan M. Taylor cfadb66dbf midi: add live MIDI 1.0 channel-voice message decoder (#2392) 2026-11-19 10:00:27 -05:00
FredAppsandFredApps 30a568b97f image-codecs: expose raw BMP density probe (#2354) [skip ci]
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
2026-11-19 21:26:09 +07:00
FredAppsandCodex 50b0ee7bf8 Expose structured palette errors for localized consumers (#2377) [skip ci]
Co-authored-by: Codex <codex@openai.com>
2026-11-19 20:36:51 +07:00
FredApps a0919f3cdb Merge pull request #2338 from FredApps/fix/786-psd-sold-prefix
PSD: stage borrowed descriptor and SoLd data framing
2026-11-19 20:12:01 +07:00
Dylan M. Taylor 1292300110 Merge pull request #1787 from el-j/feat/audio-dsd
craft-audio: DSD audio (DSF and DFF) to PCM
2026-11-19 06:54:33 -05:00
FredApps a49f56c504 Merge current video decoder main into PSD stack [skip ci] 2026-11-19 12:43:16 +01:00
FredApps 6d0aba2eeb Merge main HPGL fix into reviewed PSD stack [skip ci] 2026-11-19 12:41:44 +01:00
Dylan M. Taylor c260a6e1c3 Merge pull request #2351 from alehel/codex/video-track-remaining-decoders
craft-video: TrackDecoder for ProRes, DNx, APV, FFV1 and VP8 (#1231)
2026-11-19 06:36:08 -05:00
FredApps b963c7a6b1 Merge current main into reviewed PSD stack [skip ci] 2026-11-19 12:35:06 +01:00
FredAppsandCodex 8fc78247a6 Fix HPGL2 byte stream encoding (#2359) [skip ci]
* fix(plotter): preserve HP-GL/2 byte encoding and pen state [skip ci]

* test(plotter): cover PE continuation bytes and palette bounds [skip ci]

---------

Co-authored-by: Codex <codex@openai.com>
2026-11-19 18:34:11 +07:00
FredApps f86a51e6c7 psd: append borrowed TySh payload framing [skip ci] 2026-11-19 11:30:36 +01:00
Dylan M. Taylor 1acd07f6bc Merge pull request #2345 from storytold/dot/pkcs7-cms-inspection-private-20261119
craft-pkcs7: add bounded borrowed CMS wire inspection
2026-11-19 05:03:32 -05:00
alehel 9ef7889f5b craft-video: dispatch ProRes, DNx, APV, FFV1 and VP8 tracks 2026-11-19 10:14:21 +01:00
el-j 7b1a8f4515 craft-audio: validate DSF container bounds and DSDIFF channel counts (#1787) 2026-11-19 09:26:19 +01:00
el-j 22710f1587 Merge remote-tracking branch 'origin/main' into feat/audio-dsd 2026-11-19 09:17:52 +01:00
Dylan M. Taylor e4252faa21 Exercise optional CMS wire sets and preserve acceptance boundaries 2026-11-19 02:55:14 -05:00
Dylan M. Taylor 67e1cfd12b Refresh private CMS inspection onto merged shared inspection main 2026-11-19 02:53:38 -05:00
William Dunn 56c3c833bb file-formats: let the codec decide whether JXL reads (#2278)
Every workspace gate with `--all-features` has been failing since #2135 taught
craft-image-codecs to read JPEG XL behind a `jxl` feature. The capability test
asserted that JXL read is `Unsupported`, full stop. With that codec feature on,
`capabilities()` forwards the codec's own answer of `Available`. The assertion
then fails.

This crate cannot read that feature through `cfg!`. The feature belongs to a
dependency. A workspace build turns it on without this crate selecting
anything. An equality against either value is therefore wrong in some build.

The test now asks the codec the same question the code asks it. It compares
the two answers. A build whose codec reads JXL must report `Available`. One whose codec
does not must report `Unsupported`. The mapping has to exist either way. A missing
codec therefore fails an assertion of its own. The comparison is never quietly
skipped. Without `raster-codecs` there is no codec to ask. The answer is
`Unsupported`.

Verified at 1.100.0 on Linux. `cargo test -p craft-file-formats -p craft-image-codecs --all-features --locked` runs the case that was failing and passes. The same test passes with `-p craft-file-formats --all-features` and with `--no-default-features`. clippy with `--all-targets --all-features -D warnings` is clean. `cargo fmt --check` is clean. Making `capabilities()` ignore the codec's read flag fails the test. That is what the comparison is for. The HEIF and deep-EXR failures in that package need the pinned corpus. My checkout has not fetched it.
2026-11-19 00:43:07 -05:00
FredApps c88e962815 psd: share borrowed SoLd data prefix [skip ci] 2026-11-19 06:14:05 +01:00
el-jandDylan M. Taylor 56847b14ad craft-captions: MP4 timed text sample codec (mov_text / tx3g) (#1781)
* craft-captions: MP4 timed text sample codec (mov_text / tx3g)

Add 3GPP TS 26.245 timed text subtitle sample decoding and encoding,
modifier box parsing (styl, hlit, hclr, krok, dlay, href, tbox, blnk, wrap),
markup conversion and tx3g sample entry configuration under feature
mov-text. Closes #1555.

* craft-captions: address reviews on mov_text formatting, twrp, and timescales.

---------

Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
2026-11-19 00:11:54 -05:00
Diego Chagas 401bf426a6 jxl: charge failed brob inflations, refuse large windows, walk boxes without a span list (#2275)
Follow-up to the brob budget:
- an over-cap or broken stream now charges the bytes it produced to the shared budget, so
  a file of many such streams cannot inflate the whole budget once per box;
- a Brotli header that declares a large window is refused before decoding (the decoder reserves
  its ring buffer up front, outside the output cap);
- boxes are walked one at a time instead of collected into a Vec of spans before the brob check.
image-codecs: document that JPEG XL ignores keep_orientation.
2026-11-19 00:11:50 -05:00
0a022b61f7 craft-sheet: built-in number formats 37 to 40 are the codes Excel reports (#2020) (#2291)
Excel 16 (en-US) reports #,##0_);(#,##0), #,##0_);[Red](#,##0),
#,##0.00_);(#,##0.00) and #,##0.00_);[Red](#,##0.00) for ids 37 to 40,
not the ECMA-376 Part 1 18.8.30 text the table held. It writes neither a
numFmt nor a FORMAT record for these ids, so the table is the only source
of their codes when a file Excel saved is read, as .xlsx or as .xls.

Co-authored-by: kiwi4boy <kiwi4boy@gmail.com>
Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
2026-11-18 23:55:20 -05:00
.CooCoo 7aaa2f8010 craft-media: mpegts::mux writes MPEG-2 transport streams frame by frame to any io::Write (#1998)
* craft-media: mpegts::mux writes MPEG-2 transport streams frame by frame to any io::Write

The mpegts feature gains a transport stream writer (ITU-T H.222.0 |
ISO/IEC 13818-1) next to the demuxer:

- PAT and PMT with the CRC-32 the demuxer checks (ts::crc32_mpeg), at
  the start, every psi_interval, directly before video keyframes, and
  after replace_writer and discontinuity; a PMT longer than one packet
  spans packets.
- One PES packet per frame for H.264, HEVC, MPEG-1, MPEG-2 and MPEG-4
  Part 2 video, AV1 (Carriage of AV1 in MPEG-2 TS), AAC (ADTS, or raw
  frames given an ADTS header), Opus (Opus transport draft V0.1.3,
  including explicit channel mappings and trims), AC-3, E-AC-3 and MPEG
  audio, with PTS and DTS modulo 2^33.
- The PCR on a stream's PID or its own, at most pcr_interval apart
  (100 ms at most), PCR-only packets in gaps, advance() for idle live
  outputs, continuity counters, random access and discontinuity
  indicators.
- Packets go out in batches of batch_packets (7 by default) built in
  fixed buffers; replace_writer returns per-segment facts.
- Frames are checked before anything is written; video frames are
  limited to MAX_UNIT_BYTES so the demuxer reads every one back.

Tests read every codec back with the demuxer (bytes, PTS, DTS, keyframes,
PCR range, no continuity or CRC warnings), check the PES header bits and
the refusals, and fuzz programs, timelines, idle gaps and output swaps.

* craft-media: mpegts::mux leaves out zero-ended AV1 padding and refuses 960-sample AAC configs

An AV1 padding OBU that ends with a zero byte, an empty one included, is
now left out like a temporal delimiter instead of failing the whole
temporal unit. Decoders ignore padding, and the trailing zero would
otherwise form a forbidden sequence with the next start code.

Codec::aac_from_asc refuses an AudioSpecificConfig with frameLengthFlag 1:
an ADTS header has no field for 960-sample frames, so decoders would read
the stream as 1024-sample frames.

* craft-media: the transport stream packet checker refuses a PCR flag in an adaptation field shorter than seven bytes

* craft-media: README states the multistream layout for 3 to 8 channel Opus

An Opus { channels } access unit is one Opus packet for 1 or 2 channels.
For 3 to 8 channels it holds the mapping family 1 streams in the order
of table 4-3 of the Opus transport draft, every stream but the last
self-delimited (RFC 6716 Appendix B). The README now says so, matching
the Codec::Opus doc comment.
2026-11-18 23:26:00 -05:00
Aleksander HelgakerandClaude Opus 5.5 2e6f11eabb craft-video: TrackDecoder for H.264, HEVC, VP9, AV1 and MPEG-2 (#1231) (#2022)
* craft-video: TrackDecoder, codec-agnostic decoding for H.264, HEVC, VP9, AV1 and MPEG-2 (#1231)

Add `craft_video::TrackDecoder`, the counterpart of craft-audio's: built
from a track's `CodecParams`, it takes packets in decode order with
their timestamps and returns `VideoFrame`s in display order, with
`flush` and `reset`. Each codec is behind its decoder feature.

Configuration: an `avcC` / `hvcC` record, Annex B parameter sets (AVI
with global headers) or nothing (MPEG-TS) for H.264 and HEVC; the
`av1C` config OBUs for AV1; a sequence header for MPEG-2. Picture data
in the configuration is refused (or, for MPEG-2, dropped by the
decoder's reset). `reset` keeps the configuration: H.264 applies it
again, HEVC and AV1 build a new decoder from it.

A call that fails keeps the frames it finished for the next call.

Add `VideoError` (Unsupported, Malformed, Frame), into which each
decoder's error converts. `av1::decode::bits` becomes `pub(crate)` for
its LEB128 reader.

Tests: unit tests for codec selection, configuration checks, hostile
configuration and kept frames; `tests/track` decodes ffmpeg-made MP4,
MPEG-TS and AVI files and compares with ffmpeg's decode, then decodes
again after a reset and from a later key packet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* craft-video: TrackDecoder review fixes (#1231)

- MPEG-2: configuration is checked before it is decoded. Every start
  code must be a sequence header, extension, user data or GOP header;
  a picture after a valid sequence header was decoded and then dropped
  by a reset, so construction succeeded. It is now Malformed.
- The decode and flush docs and the README say what each codec keeps
  after its own decoding error: H.264 keeps finished pictures, HEVC
  only its newest 32 while calls keep failing, VP9 those of earlier
  packets, MPEG-2 unless the packet made too many, and AV1 drops those
  of the failing decode or flush. Frames that fail to convert are
  still kept for the next call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 23:25:56 -05:00
Dylan M. Taylor 4ce34ca37e Add bounded borrowed certificate inspection views (#2325)
Keep wire evidence separate from existing verification and trust APIs. Inspection semantics acknowledge Afloat’s original Craft Anything raw-field and non-minimal-length contributions.
2026-11-18 23:23:21 -05:00
cbf6840b10 Add craft-ppt-binary: DeckCraft's PowerPoint 97-2003 reader on craft-cfb and craft-pptx (#2316)
* ppt-binary: open PowerPoint 97-2003 .ppt/.pot/.pps files

New crate deckcraft-ppt (L3), written from the public [MS-CFB], [MS-PPT]
and [MS-ODRAW] Open Specifications: a compound-file reader (ported from
FilmCraft's clean-room reader), the edit chain and persist directory, and
the OfficeArt drawings. Main masters become masters (colours, fonts, text
styles, background, decorations), title masters become layouts; slides
keep their shapes (presets, freeforms, groups, rotation, flips), fills,
lines, shadows, pictures (PNG, JPEG, DIB, TIFF, EMF, WMF), text with the
master styles resolved into it, fields, notes and hidden flags.

Import only: an opened .ppt has no save path, so Save asks for a new
name. A .pps from the system starts the slide show. File dialogs, drag
and drop, the web shell and the macOS, Windows and Linux file
associations offer the three extensions. Tests build .ppt files from
records and sweep hostile input.

From storytold/deckcraft@0aef89cb1a (storytold/deckcraft#1137).

* ppt-binary: address review: budget picture decoding, read each persist directory once, macOS .pot/.pps types

- Pictures decode lazily, when a shape first uses them, each at most once and all
  within a shared 4 GiB budget: many store entries pointing at one deflated blob
  can no longer ask for unbounded memory.
- A persist directory named by many edits is read once.
- Info.plist declares com.microsoft.powerpoint.pot and .pps alongside .ppt.

From storytold/deckcraft@9e575ccecc (storytold/deckcraft#1137).

* ppt-binary: address review: check the picture budget before copying bitmap data

From storytold/deckcraft@470a429392 (storytold/deckcraft#1137).

* ppt-binary: build against current main

- convert.rs: set `flip: None` on imported gradients. `Gradient` gained the field in
  ad97533a; None is what an unflipped gradient was before.
- tests.rs: split `imports_a_presentation` into one check per section (title, picture,
  group, text box, master) for the workspace `cognitive_complexity` lint (6ddd2fb8).
  The assertions are unchanged.
- Cargo.lock: deckcraft-ppt takes the workspace version, 0.15.0.

From storytold/deckcraft@a0ececefeb (storytold/deckcraft#1137).

* ppt-binary: keep the picture budget on 32-bit targets

`MAX_TOTAL` was `4 << 30` as a `usize`. On wasm32 that is 2^32, which wraps to 0
without any error, so the web build's picture budget was zero and every .ppt
picture was dropped. Use the address space as the limit there. A compile-time
assertion that the budget holds at least one picture keeps it from happening
again on any target: the CI wasm step (`cargo check`) now fails if it does.

From storytold/deckcraft@4fd930ce1a (storytold/deckcraft#1137).

* ppt-binary: read past the character fields PowerPoint 2002 and later add

A TextCFException can end with pp10runid (mask bit 20), newEAFontRef (24),
csFontRef (25) and pp11ext (26), after `position`. read_cf stopped at
`position`, so in a StyleTextPropAtom the next run's count and mask were read
from the leftover bytes, and every later run got garbage formatting or the
walk ended. Master text styles go through the same reader. The fields are
read past and not used. The test has a run carrying all four followed by a
bold 18 pt run, which now reads as written.

From storytold/deckcraft@773af639c9 (storytold/deckcraft#1137).

* ppt-binary: convert each listed object once and index notes pages

Nothing stopped a slide list from naming one persist object many times, and
each listing converted its whole drawing again: a 100k-shape slide listed
180k times fits in about 10 MB and makes 1.8e10 shapes. An object is now
listed once across the slide, master and notes lists (PowerPoint never lists
one twice), and a repeat is logged and skipped. Notes pages are looked up
through a map built once, instead of a scan per slide (slides x notes). The
first matching page still wins.

From storytold/deckcraft@b3aa0983bd (storytold/deckcraft#1137).

* ppt-binary: find formatting runs by binary search

paragraphs() found the run at a position (rposition) and the next run start
(find) by scanning the run starts for every run, break and field, so text
cost grew with chars x runs. The starts are a running sum and never
decrease, so both lookups are now partition_point. Measured in a debug
build, 640k one-character runs (about 6 MB of file): 75 s before, about 2 s
after. The test uses a 20 s bound, like render's pathgrad budget test.

From storytold/deckcraft@b70b022362 (storytold/deckcraft#1137).

* ppt-binary: cap decoded pictures at the .pptx package total

The picture budget was 4 GiB, so a few MB of small deflated metafiles, each
inflating to 64 MiB, could make the import hold 4 GiB. A .pptx package may
inflate to 2 GiB in total (deckcraft-pptx opc MAX_TOTAL), and pictures are
the only part of a .ppt this crate inflates, so use the same 2 GiB. That also
fits a 32-bit usize, which replaces the wasm32 special case. This is a limit
change, so there is no new test: the budget test
(the_store_decodes_lazily_within_a_budget) and the compile-time check that
the budget holds a picture still cover it.

From storytold/deckcraft@a9cefff8b8 (storytold/deckcraft#1137).

* ppt-binary: fall back to the first main master the same way every time

A slide naming a master that doesn't exist fell back to the lowest index in
the masters HashMap. A title master is stored with its main master's index,
so the two tied and the HashMap's random order picked one: the same file got
the "Title Master" layout on some opens and the main master's on others. The
fallback now considers main masters only. The test opens such a deck 30
times; before the fix it took the title master's layout within those opens.

From storytold/deckcraft@60942d5950 (storytold/deckcraft#1137).

* ppt-binary: try the edit scan before calling a file too old

Any Current User token other than the plain or encrypted one, including none
at all from a truncated record, returned TooOld at once. A PowerPoint 97 file
with a damaged Current User stream was reported as "made by PowerPoint 95 or
earlier", and the UserEditAtom scan meant for a missing stream never ran.
[MS-PPT] allows only those two tokens, so an unknown one can't tell a damaged
file from an older format. The scan now runs, and TooOld is returned only when
it finds no edit record behind an unknown token.

From storytold/deckcraft@3869c3dc51 (storytold/deckcraft#1137).

* ppt-binary: read persist directories within one stream's worth of words

dirs_seen only skips a directory named at the same offset again. Directories
nested inside one another, each named by its own UserEditAtom, were each read
to the end of the stream: MAX_EDITS x the stream. In a debug build, 4095 such
edits over a 64 MiB stream took about 48 s. All directories now share a budget
of stream.len() / 4 words. Real directories are separate records inside the
stream, so they always fit. The hostile case stops in milliseconds and is
reported as damaged.

From storytold/deckcraft@5799048d88 (storytold/deckcraft#1137).

* ppt-binary: check two additions on input-derived sizes

- cfb.rs: the mini sector end `at + MINI_SECTOR_SIZE` was unchecked. On a
  32-bit target (wasm32), a sector number near 0x03FF_FFFF puts `at` at the
  top of usize, so the add panics in a debug build and wraps in release.
- text.rs: the style-run total `chars.len() as u32 + 1` truncated and could
  overflow past u32::MAX characters. It now saturates.

Neither case can be reached in a native test (one needs a 32-bit target, the
other more than 4 GiB of text), so there is no new test. The `+ 1`s in
convert.rs paragraphs() that the review also named are bounded by the text
length and can't overflow, so they are unchanged.

From storytold/deckcraft@b58c354246 (storytold/deckcraft#1137).

* ppt-binary: a sector chain that revisits a sector is an error

read_chain stopped at the stream's size, so a FAT loop shorter than the stream returned the
looped sectors again as the stream's bytes. It now tracks visited sectors and fails on a revisit,
and reserves the stream's size (capped at the file length) up front.

a_looping_chain_stops expected the repeated bytes; it now expects the error (eliets2's review).

From storytold/deckcraft@2b0940bff5 (storytold/deckcraft#1137).

* ppt-binary: slide shapes inherit from their own master's shapes

Master shape properties were remembered by shape id alone, so a later master (a title master,
or a second main master) that reused a shape id replaced the first master's entry, and slides
inherited fill and line from the wrong master. They are now keyed by master slide id and shape id,
and a shape's hspMaster is looked up in its slide's master, then a title master's main master.
Notes pages have no imported master, so they inherit nothing.

PowerPoint gives shapes file-unique ids, so this takes a damaged or generated file (eliets2's
review).

From storytold/deckcraft@7ad2f5152b (storytold/deckcraft#1137).

* ppt-binary: drop the unused fBackground field

RawShape.background was set from the FSP flag but never read: the background shape is the
drawing container's own shape (OfficeArtDgContainer.shape, [MS-ODRAW] 2.2.13), which drawing()
already takes. The comment there now says so (eliets2's review).

From storytold/deckcraft@afd57f47e0 (storytold/deckcraft#1137).

* ppt-binary: shadowed text keeps its shadow

TextCFException's shadow bit was read and merged but never reached the run. A shadowed run now
gets a shadow in the colour scheme's shadow colour, at the distance and direction of the app's own
Text Shadow command, with no blur (the record has none). Emboss has no counterpart in the model,
so its field is gone and the loss is listed in the docs (eliets2's review).

From storytold/deckcraft@ab5cf618e1 (storytold/deckcraft#1137).

* ppt-binary: the .pps show-on-open test opens a real 97-2003 file

a_ppsx_from_the_system_starts_the_show saved a .pptx under the name "Old talk.pps", so it went
through the PPTX path and never reached the legacy importer. crates/ppt/tests/fixtures/old-talk.pps
is a one-slide .pps built from records by the ppt tests (rebuilt with DECKCRAFT_WRITE_PPT_FIXTURE=1,
checked on every run), attributed CC0 like the other generated fixtures, and the UI test opens it
(eliets2's review).

From storytold/deckcraft@f511a2a66b (storytold/deckcraft#1137).

* ppt-binary: test mini streams, 4096-byte sectors and the DIFAT chain

The compound-file test builder only made version-3 files with 512-byte sectors, no mini stream
and every FAT sector in the header, so read_mini_chain, 4096-byte sectors and the DIFAT chain never
ran. build_with takes the sector shift and the mini stream cutoff, and lists FAT sectors past the
header's 109 in DIFAT sectors; build is build_with(streams, 9, 0), so existing tests see the same
layout. Three tests read streams back through each path (eliets2's review).

From storytold/deckcraft@212788b693 (storytold/deckcraft#1137).

* ppt-binary: test every picture kind, two-UID blips and blips inside the FBSE

The blip tests covered PNG, deflated WMF and DIB only. New tests decode JPEG (RGB and CMYK), TIFF
and PNG with one and two UIDs, an uncompressed EMF with each UID count, a metafile over the budget
(compressed or not), and a blip held inside its FBSE rather than in the Pictures stream. All
passed as written (eliets2's review).

From storytold/deckcraft@fe8023b9c2 (storytold/deckcraft#1137).

* ppt-binary: placeholder text held only in the slide list is imported

A shape's client text box may hold just an OutlineTextRefAtom, with no TextHeaderAtom ([MS-PPT]
OfficeArtClientTextbox): the text lives in the slide list, and that is the usual form for slide
placeholders. read_block returned None without a header, so text_block never reached its
outline fallback and the placeholder came in empty. A block with a reference and no header is
now returned for the caller to follow.

placeholder_text_can_come_from_the_slide_list covers the reference alone (it failed before this
change) and a header with a reference; the test document builder can put outline blocks in the
slide list (streams_with_outline). Found writing the test eliets2's review asked for.

From storytold/deckcraft@bf8ec603f3 (storytold/deckcraft#1137).

* ppt-binary: test newer edits and the two other encryption signs

doc::read had tests for one edit and the Current User token only. a_later_edit_replaces_a_slide
adds an edit whose persist directory gives the slide a new object; the newer slide is imported and
the master from the older directory is kept. encryption_is_found_in_the_edit_and_the_persist_directory
covers an edit record long enough for encryptSessionPersistIdRef and a CryptSession object named
by a later edit. Both passed as written (eliets2's review).

From storytold/deckcraft@f0b8525cc6 (storytold/deckcraft#1137).

* ppt-binary: test title masters and slides that follow nothing

No test made a slide of a title master or a slide with the follow-master flags off. The new test
checks that a title master becomes a "Title Master" layout with its own background and shapes
and without the master's shapes, that its slide uses that layout and follows its background, and
that a slide with all three flags off keeps its own background and colour scheme and hides the
master's shapes. It passed as written (eliets2's review).

From storytold/deckcraft@a41bf545e7 (storytold/deckcraft#1137).

* ppt-binary: merge boolean properties flag by flag

A boolean property word holds sixteen flags, each with its own fUse bit.
Props::inherit and add_table kept the whole word from the most specific
set, so a placeholder or text box that set only fNoFillHitTest lost the
inherited "not filled" and "no line" and was drawn with a fill and an
outline. Merge those words per flag instead (storytold/deckcraft#1137 review, issue 1).

From storytold/deckcraft@79ae833152 (storytold/deckcraft#1137).

* ppt-binary: recover a broken edit chain and report lost slides

An edit whose previous-edit offset points back at itself (or anywhere
that isn't an edit) cut the older edits off, and with them the persist
directories holding the slides: such a file opened as an empty deck
with no warning. When the chain doesn't end at offset 0, read every
edit's persist directory in the stream, newest first, filling only what
the chain left unset.

Slides the slide list names but whose objects are still missing are now
returned by deckcraft_ppt::import_checked and reported like a damaged
.pptx: lostSlides, a "(Repaired)" copy and the CLI warning
(storytold/deckcraft#1137 review, issue 3).

From storytold/deckcraft@135674101f (storytold/deckcraft#1137).

* ppt-binary: picture frames, inline picture fills, gradients, footers, numbering

The remaining differences from LibreOffice in the storytold/deckcraft#1137 stress test:

- Picture frames (and OLE frames) that say nothing about fill or line
  start with neither, as placeholders and text boxes do, instead of the
  drawing defaults' fill.
- A pib or fillBlip held in the property's own complex bytes (fBid) is
  decoded within the picture budget: table cells with a picture fill
  showed a plain colour.
- Shaded fills put the back colour at fillFocus ([MS-ODRAW]), and the
  linear angle follows how LibreOffice writes and reads it (0 degrees
  from the top): the linear gradient was reversed, the radial inside out.
- HeadersFooters (the slide's, else the document's) add the date,
  footer and slide number placeholders; the master's footer placement,
  alignment, size and colour reach every layout.
- Numbering from the document's ___PPT9 tag (OutlineTextProps9, pp9rt
  in the runs' fontStyle) turns bulleted paragraphs into numbered ones.
- Wingdings diamonds draw as a diamond, not a dot.

From storytold/deckcraft@24437bd075 (storytold/deckcraft#1137).

* ppt-binary: read CString records up to their first NUL

Header/footer text and the ___PPT9 tag name were decoded from the whole
CString body. A writer that ends the string with a NUL would put the NUL
into the footer text and make the tag name fail to match, losing the
numbering. Stop at the first NUL, as the font names already do.

From storytold/deckcraft@110e1420fd (storytold/deckcraft#1137).

* ppt-binary: on craft-cfb and craft-pptx (the move from DeckCraft)

What the move from storytold/deckcraft#1137 changes; the commits before this one are that
PR's crates/ppt as it is on its branch, without its manifest.

- craft-cfb replaces the crate's own compound-file reader (cfb.rs, 552 lines). Streams are
  read capped at the file's length, as before. Its six tests (looping chains, mini streams,
  version 4 sectors, the DIFAT) are covered by craft-cfb's own. The byte helpers move to
  record.rs. Test files are written by craft-cfb's writer.
- deckcraft-model, deckcraft-color and deckcraft-geom become craft-pptx and craft-drawingml,
  the same types (storytold/deckcraft#2179, storytold/deckcraft#2180 and #792's plan). A gradient now states its
  shape and rotate-with-shape explicitly, as craft-drawingml's are optional.
- DeckCraft's default master (defaults::build_master and blank_presentation) becomes the
  caller's craft_pptx::Defaults: import(bytes, &defaults), as craft_pptx::import takes. The
  file's masters take the default master's layouts and placeholders, then the file's theme,
  placeholder boxes and styles. The tests use a default master with title, body and footer
  placeholders and the seven layouts .ppt layout types map to; a new test reads with
  craft_pptx::Plain.
- The two tests that drive DeckCraft's engine (open and save, lost slides in the app) stay in
  DeckCraft.
- The fixture's rebuild variable is CRAFT_WRITE_PPT_FIXTURE; old-talk.pps is unchanged and
  gets its ATTRIBUTION row. Bare #1137 references in comments name storytold/deckcraft#1137.
- README, crate README (doctested) and the workspace entry.

* ppt-binary: bound text, strings, paths and repeated work from hostile files

Tab stops keep the first 64 entries while still reading past the rest, string properties stop
at 4096 units, and a freeform path uses at most 8192 vertices, since each of these is copied
into every paragraph or inheriting shape. An outline block in the slide list is the text of
one shape only; a second reference keeps the shape's own text.

The fallback master and each master's layout per type are found once before the slides are
converted, a shape's primary property tables are collected without inserting at the front,
and a compressed metafile that fails to inflate is charged to the picture budget.

* ppt-binary: review fixes for footers, rulers, title masters, paths and numbering

A slide's own headers and footers record (instance 0) now wins over the document's, and a
text box that points at an outline block keeps the margins and indents of its own ruler. A
slide list entry whose object is not a slide is reported as lost.

Title masters place their layout's placeholders from their own placeholder boxes, adding any
the title layout lacks, and copy only placeholders from an earlier title layout. Slides that
don't name a title master no longer pick its layout.

Freeform paths skip the points of escape segments, and without segments follow shapePath
(closed lines by default, open lines or curves). DIB colour tables are sized by bit depth and
refused when they run past the bitmap. Numbering schemes 0x10 to 0x28 map to their DrawingML
names, master style levels go to the level they name, and a broken edit chain reads the newest
edits rather than the oldest.

The nested persist directory test now checks the file is reported damaged, the footer test
fails when a layout has no slide number, and the README says tables come in as groups of
shapes.

* ppt-binary: second review round: failed pictures, title layouts, notes, arcs and property tables

Inflating a compressed metafile is now charged its compressed bytes as well as its output, and
is refused when those bytes alone pass the remaining budget, so many entries pointing at one
stream that inflates to nothing can't each read it again for free.

A title master's layout starts only from the defaults' own title layout, not one made for an
earlier title master. A notes page shared by two slide records with the same slide id goes to
the first only. After elliptical quadrants or a quadratic Bezier escape a path goes on from
their last point; after an arc or angle ellipse, whose end isn't one of its vertices, the path
stops rather than draw from the wrong place. A property set keeps at most 1024 distinct
properties, so copying the drawing defaults into each shape costs a bounded amount.

* ppt-binary: take each main master's title-layout base once; test outline notes

A title master's layout starts from the placeholders of the defaults' title layout. They are now
taken once, when the main master is made, instead of rebuilding the set of title-master layouts
and rescanning the master's layouts for every title master, which was quadratic in title masters.

A notes page whose body text is in the notes list's outline block also goes to one slide only.

---------

Co-authored-by: Oliwier Kulczycki <oleknuso282@gmail.com>
Co-authored-by: kiwi4boy <kiwi4boy@gmail.com>
2026-11-18 23:23:02 -05:00
.CooCoo c39072d321 image-codecs: keep PrefixDetector tests within the prefix contract (#2277)
PrefixDetector::detect requires each call's bytes to start with the
previous call's bytes. Two integration tests passed a buffer that broke
that rule, so a detector that rechecks the SOI before resuming would
have failed them while still honoring the contract.

The tests now pass longer prefixes of one file and compare each answer
with detect_prefix on the same bytes. The check that a walk resumes at
the marker it stopped at stays in the jpegls unit tests, and a new unit
test checks that a walk that found a non-JPEG-LS frame header stays at
that marker.
2026-11-18 23:20:49 -05:00
mtlcl410 d2a7d88d2e hayro-postscript: a \ddd escape above \377 keeps its low eight bits (#2321) (#2324)
A literal string's octal escape was converted with `u8::from_str_radix`,
which fails above 0o377, so the byte was dropped. Read one to three octal
digits into a u16 (at most 0o777) and push the low byte, as ISO 32000-2
7.3.4.2 and the PostScript Language Reference (third edition, 3.2.2)
specify: "high-order overflow shall be ignored". Escapes up to `\377`
decode as before.

Record the patch in SOURCE.json and vendor/README.craft-reader.md.

Fixes #2321
2026-11-18 23:20:45 -05:00
.CooCoo 4e0c880f58 craft-csv: delimiter detection samples 65,536 characters, not 64 KiB (#2326)
sniff_delimiter read the first 64 KiB of the text. A first field of
three-byte characters longer than about 21,800 characters filled that
sample before its delimiter, so a semicolon or tab file opened as
comma-separated. The sample is now the first 65,536 characters, the
amount detection read before it moved into craft-csv.

The new test fails without the change: a first field of 65,535
three-byte characters followed by a semicolon is detected as comma.
2026-11-18 23:20:42 -05:00
FredApps a51b0f81db psd: share borrowed layer effects and solid color framing 2026-11-19 04:25:01 +01:00
aiongg 36ca4574e4 Merge pull request #2318 from aiongg/ci-tier1
Workspace CI: own cache entries per gate call, stripped test binaries, no examples in the test build
2026-11-18 22:21:51 -05:00
Dylan M. Taylor c24d572c8f Add private bounded CMS wire prefix views 2026-11-18 22:03:03 -05:00
Dylan M. Taylor adb9e769ca Add bounded borrowed certificate inspection views
Keep wire evidence separate from existing verification and trust APIs. Inspection semantics acknowledge Afloat’s original Craft Anything raw-field and non-minimal-length contributions.
2026-11-18 21:57:49 -05:00
Dylan M. Taylor c350c5eedd Merge pull request #2078 from texjer/craft-develop-inpaint
craft-develop: the crate, with inpaint from LightCraft (#587)
2026-11-18 21:37:58 -05:00
FredApps bd3fd7cc70 formats: add borrowed iterative PSD descriptor writer 2026-11-19 03:28:39 +01:00
aiongg e701f54d0a workspace: own cache entries for the WASM and 1.95 calls, stripped test binaries, no examples in the test build
Needs craft-common-actions gate.yml with the cache-name and dev-strip inputs.
2026-11-19 02:22:51 +00:00
FredApps 13ca2272a9 Merge pull request #2307 from FredApps/fix/786-psd-hue-level-writers
psd: share raw hue and levels block writers
2026-11-19 08:44:35 +07:00
texjer bf11227dae Merge main into craft-develop-inpaint: the crate now also holds spline, curve and lut 2026-11-18 20:41:04 -05:00
William Dunn 4141fe7a9f craft-gpu: provider-neutral GPU job traits and the wgpu backend (#663)
* craft-gpu: add the GPU job traits and the shared providers.

This carries over crates/gpu, crates/gpu-wgpu, crates/gpu-null, and crates/gpu-providers from the cut-down #160 branch, with minimal workspace wiring.

None of these crates names a vendor or any app. craft-gpu defines GpuJob and ProviderRegistry. craft-gpu-null is an in-memory context for tests. craft-gpu-providers holds the shared craft.* WGSL providers. craft-gpu-wgpu is the wgpu backend, native and WebGPU.

* craft-gpu: real device wiring, device loss and async readback (RFC-0022)

Addresses skylartaylor's review gate on #663 at 138f7b2. RFC-0022 has merged
since that review. This follows its acceptance requirements.

WgpuContext now requests a real device. DeviceCaps comes from that device,
reflecting the limits and features actually enabled on it. Buffers are real
wgpu::Buffer values when a device exists. The no-adapter case still degrades
to the same staging behavior as craft-gpu-null. The RFC defines that case
explicitly as the no-adapter path. Device loss is registered via
set_device_lost_callback. It surfaces as GpuFault::DeviceLost. It never
surfaces as a panic. The recovery is stated on GpuContext's trait docs.

GpuContext::read_buffer is no longer a required method. The primitives are
request_read and poll_reads. That mirrors craft-worker-host's own
HostMessage::GpuJobs to WorkerMessage::GpuBatchDone split one level down.
read_buffer stays as a default blocking convenience. It resolves immediately
on the null and staging paths. Native wgpu blocks on
Device::poll(wait_indefinitely). On wasm32 it returns GpuFault::Operation,
since a blocking wait there would freeze the one thread map_async's own
callback needs to run on.

crates/gpu-wgpu/src/tests.rs adds a real-backend suite, gated on
adapter-probe plus non-wasm32. It runs upload, readback and device-loss
tests against a real WgpuContext. It also runs three craft-gpu-providers
CPU-stand-in providers against that same real WgpuContext. It skips with a clear message when no adapter is present.
Verified against lavapipe with mesa-vulkan-drivers, using
--features adapter-probe,native-vulkan: every test passes. That run first
caught a real wgpu panic on buffer lengths that are not a multiple of 4,
COPY_BUFFER_ALIGNMENT. The fix pads real buffers transparently. Every caller
still sees exact, unpadded bytes.

docs/gpu-backends.md and docs/gpu-providers.md are updated to match,
including named consumers (the runtime slice first, then EffectCraft and
FilmCraft) and a device-ownership note for when egui's wgpu renderer is also
running.

* craft-gpu: buffer-size guards, empty-buffer parity, read_buffer keeps other completions

Answers the six findings in CodeRabbit review 5852678306 on PR #663.

upload_buffer on the device path refuses a padded size past the device's
max_buffer_size with GpuFault::InvalidJob before creating the buffer.
request_read guards its staging copy the same way. An oversized request
used to reach wgpu as a validation error on the device's error scope.

Empty buffers are accepted everywhere, matching craft-gpu-null and the
documented staging parity. The device path resolves an empty readback
immediately (wgpu refuses an empty map range). The blanket InvalidJob on
empty upload bytes is gone.

read_buffer no longer eats completions that belong to another
outstanding request. The wgpu override re-queues them for the next
poll_reads. The null context gains an override that takes only its own
completion. The trait's default-body contract is documented: with the
default body, do not interleave read_buffer with an outstanding
request_read.

ReadbackProvider validates the storage-binding cap directly. The old
chunk_buffer call allocated a Vec of slices only to drop it.

parse_u32 and params_contain refuse an empty prefix or needle.
windows(0) panics and the crate's rule is never to crash.

The manifest guard test now also rejects *-engine dependency lines, per
docs/gpu-providers.md.

* craft-gpu: per-job batch results, wasm staging reads resolve

Two findings CodeRabbit raised against the carried copy on PR 662, fixed here where the crates live. dispatch_batch now answers per job in input order. The old first-failure abort discarded outcomes earlier providers had already produced, leaving the caller nothing to reply with and no way to name the jobs worth retrying. A job fed by a failed predecessor fails honestly on its own bad handles. On wasm32 read_buffer now serves the staging backing, whose reads resolve synchronously. The backing on that target is always staging today. The refusal remains for a read that did not resolve synchronously, guarding the future wasm device backing where blocking would hang the tab.

* Add free_buffer and device_status to GpuContext.

Two CodeRabbit findings against crates/gpu-wgpu, both answered at the
trait level since craft-gpu-null has the exact same gap.

free_buffer (lib.rs:313). Every upload_buffer call added an entry to a
backend's buffer table. So did every output buffer a provider's job
created. Nothing ever removed one. Repeated jobs retained memory for
the whole lifetime of a context. The new required method releases a
buffer's resources. A freed handle behaves as invalid afterward, the
same fault an unknown handle already produces.

device_status (lib.rs:401). poll_reads can only attach a device-lost
fault to a read it has something to attach it to. A caller whose event
loop only polls, with nothing pending when loss happens, could never
observe it. The new method, default Ok(()), covers that gap directly;
a backend with no concept of device loss needs no override.

MemContext in this crate's own tests gets the same free_buffer shape as
craft-gpu-null, to keep it compiling under the new required method.

* Implement free_buffer for NullContext.

buffers moves from Vec<Vec<u8>> to Vec<Option<Vec<u8>>>. A handle is a
stable index. Freeing a slot replaces it with None. Removing it
instead would shift every later handle's index out from under its
caller. buffer_len and request_read now reject a freed index the same
way they already reject one that never existed.

Two new tests. One frees a handle and checks another's index and bytes
stay untouched. One frees a handle twice, and a handle that never
existed, and confirms both are a harmless no-op.

* Fix the no-device caps fallback, capture allocation failures, free buffers.

Four CodeRabbit findings against this crate.

The no-device fallback in WgpuContext::new called probe_caps() again
on request_device failure (lib.rs:228). A second, successful adapter
query would then report the adapter's advertised limits as if they
came from a granted device, for a context that holds none. It now
falls back to the plain, fixed caps probe_caps's own doc comment
already promises for that case.

Allocation failures during buffer creation used to reach wgpu's
default uncaptured-error handler (lib.rs:299). That handler panics.
The size check already in place only catches a request past the
device's advertised maximum. It says nothing about whether the device
can actually allocate that many bytes right now. An error scope around
both the output-buffer and the read-staging-buffer creation converts a
failure into a GpuFault instead.

free_buffer for WgpuContext (lib.rs:313) matches the Option-wrapped
shape just added to craft-gpu-null. Both backings, staging and real
device, release a buffer's resources and make the handle behave as
invalid afterward, without shifting any other handle's index.

device_status for WgpuContext (lib.rs:401) reports device loss through
the trait method just added to GpuContext. A caller that only polls
can now observe loss even with nothing pending.

New tests cover the fixed fallback value and a regression check that
the new allocation error scope does not misfire on an ordinary
allocation. They also cover free_buffer on both the staging and the
real-device path. One more covers device_status observing a destroyed
device with nothing outstanding. A genuine out-of-memory condition is not reliably
reproducible in CI; the allocation-failure test is the honest half of
that fix this can run.

* Fix the error-scope API call and run cargo fmt.

wgpu 30.0.1's Device has no pop_error_scope method. push_error_scope
returns an ErrorScopeGuard. pop() lives on that guard. Keep the guard
from push_error_scope and call pop() on it.

Also drops an unneeded mut on a test binding that never mutates its
context. Also runs cargo fmt on the lines the Option-wrapped buffer
changes touched.

* Drop a needless return clippy flagged in the adapter-probe lane.

The fallback branch in WgpuContext::new is the function's own tail
expression once the real-device branch above it has already returned
early. The explicit return on it was redundant.

* Run cargo fmt on the no-device fallback branch.

* Pop the OOM scope before the call that would misuse a failed buffer.

upload_buffer popped its scope only after write_buffer. request_read
popped its scope only after the copy and its submission. A buffer that
failed to create is invalid. Using an invalid buffer raises a VALIDATION
error that an OutOfMemory-only scope never catches. The default
uncaptured-error handler still panicked on a failed create even with the
scope in place. Pop right after create_buffer in both paths and return
before the buffer is used again, with a separate scope around the later
write or copy.

write_buffer only queues its copy into wgpu's PendingWrites. An upload
with no following submission kept the destination and staging buffers
alive inside wgpu-core until some other submit happened. upload_buffer now
flushes with an empty queue.submit right after its own write_buffer call.
A free_buffer right after an upload can now actually release the
allocation.

* Run cargo fmt on the new ordering test.

* craft-gpu-wgpu: correct the crate docs on wasm32 read_buffer

The staging backing serves wasm32 reads synchronously since the staging-reads fix. Only a read that did not complete synchronously faults. The crate-level summary still described the old unconditional fault.

* craft-gpu: sync the docs with the implemented readback behavior

Review asked for three corrections. The backends doc, the providers doc and the trait docs now state that both bundled backends override read_buffer's default body and that wasm32 serves the staging read, with a fault only for a read that did not resolve synchronously. The runtime follow-up paragraph now records that #662 consumed it. The software Vulkan container run is described as local testing. Hosted CI coverage and the pilot consumers' browser and hardware validation remain their own requirements. Em dashes swept from both docs per the house writing rules.

* has_device: say the answer once, in this file's own shape

Clippy 1.100.0 refuses the old body under `needless_bool`. The `if` returned a
bool literal with a bare `false` after it. The cfg attribute sat on the `if`
itself. The whole statement therefore vanished without the adapter-probe
feature.

Two cfg blocks replace it, one per configuration. `probe_caps` in the same
file already has that shape. `Backing::Device` exists only under that feature.
The clippy suggestion on its own would not compile.

The plain clippy leg never saw this. The line compiles only with adapter-probe
on. The all-features leg catches it, as does any workspace build that unifies
the feature in.
2026-11-18 19:05:00 -06:00