Commit Graph
70 Commits
Author SHA1 Message Date
becauseno7 25a7d98ebc PDF import: a trailer string in a stream does not trigger the window fallback
A `trailer` marker inside an unreferenced stream followed by `(` and more
than 4 KiB of text made the lexer stop at the window's end, so a later
`/Encrypt` name anywhere in the file refused a plain file. The unbounded
scan read a string there and opened it. The past-the-window fallback now
applies only when no object starts in the window or the first one opens
a dictionary (`<<`, including one split by the window's end).

Regression test with `trailer(` and `trailer[` in a stream and a later
Encrypt name.
2026-11-01 14:44:26 +06:00
becauseno7 98484975c4 PDF import: a name cut by the trailer window is read whole
The pre-scan window could end inside a trailer key, so a decoy like
`/Encrypted` cut right after `/Encrypt` was taken for the Encrypt key
and an unencrypted file was refused. A window that ends mid-token now
ends before that token instead, and the past-the-window fallback reads
the name whole (a real `/Encrypt` cut as `/Encryp|t` is still refused).

Tests for that boundary, for a trailer with a long /ID, and for `#`
without two hex digits staying as written in a name.
2026-11-01 13:31:59 +06:00
becauseno7 cd6c56b78d PDF import: the past-the-window /Encrypt fallback matches escaped names
The fallback searched for the literal bytes `/Encrypt`, so a long trailer
with the key written as `/Encr#79pt` (or any other #-escaped spelling) got
past it. It now finds the last name token that decodes to `Encrypt`, with
the lexer's own name decoding, and checks whether that token ends past the
window. It is still one linear pass per file. Longer names that only start
with `Encrypt` (`/Encrypted`) no longer count.
2026-10-31 22:07:29 +06:00
becauseno7 4319df2e59 PDF import: the encryption pre-scan reads a bounded window after each trailer (#2142)
The pre-scan lexed one object after every `trailer` marker over the rest of
the file, so an unterminated string or dictionary after each of many markers
made opening a crafted PDF quadratic. Each lex now gets a 4 KiB window; when
it runs out, the file is refused if `/Encrypt` appears past the window (one
search per file), so long trailers can't hide the key.
2026-10-30 14:46:34 +06:00
Dylan M. Taylor 51b910657d Refactor pdf for strict Clippy checks 2026-10-28 06:09:21 +00:00
aiongg bc4b48f67d fix(ui): dropdown menus grow back after a search with no matches (#2511)
* fix(ui-egui): craft_ui::ComboBox for every combo box, so open menus grow back (egui#5225)

Repins craft-libs to aiongg/craft-libs 60d60d48 (storytold main with the shared
dropdown) and bans egui::ComboBox in clippy.toml.

* fix(ui-egui): font menu under the font field is a craft_ui combo menu that grows back

The filter row is the menu's header and only the font list scrolls, so a search
that matched nothing grows the menu back when it is cleared.

* chore(deps): craft-libs 4d7b82f7 (dropdown fixes)

* chore(deps): craft-libs 92d392cf (#387 merged)

* chore(xtask): pdf-deps expects craft-libs 92d392cf
2026-10-27 10:27:52 -04:00
aiongg b7b75ed37a style: cargo fmt on the moved files 2026-10-26 21:54:30 +00:00
aiongg 3e38bd7349 refactor(pdf): split the PostScript interpreter ps.rs into ps/*.rs 2026-10-26 21:49:12 +00:00
aiongg 576f1d1706 refactor(pdf): move loose test files to src/tests/ 2026-10-26 21:49:11 +00:00
aiongg 5a16de0948 Pin craft-libs crates to main 512b5435 2026-10-26 03:14:07 +00:00
aiongg fce4a88c92 Timeline: comp tabs draw through craft-ui's extra-tabs hook
Pin craft-libs crates to 3723e32a, which adds the group extra-tabs hook.
The comp tabs follow the panel tabs directly, with no drag bar between
them, and the group header holds only the lock and the panel menu.
2026-10-26 02:44:56 +00:00
aiongg 7c776d0b60 Pin craft-libs crates to main 1e6f1278 2026-10-26 02:13:50 +00:00
aiongg 6d063fc9de Merge upstream main into craft-ui-docking
craft-libs crates move to one rev, 37c907d2 (contains main's craft-update and craft-docpath pins).
Docs: native floating windows are Windows, macOS and X11 only; the UI estimate drops the
multi-monitor panel work that is done.
2026-10-26 01:59:50 +00:00
skylar c16a628849 chore(deps): refresh safe dependency bumps
serde_json 1.0.154, proptest 1.12.0, objc2 0.6.5, winresource 0.1.34, pollster 1.0.1, miniz_oxide 0.9.1, linesweeper 0.5.0, lz4_flex 0.14.0, muda 0.21.2.
2026-10-25 16:36:21 -06:00
aiongg 26dd2ab814 Merge #2367 (egui 0.37) into craft-ui-docking
# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	apps/effectcraft/src/main.rs
#	crates/ui-egui/src/control.rs
#	crates/ui-egui/src/dock.rs
#	crates/ui-egui/src/dock_ui.rs
#	crates/ui-egui/src/lib.rs
#	crates/ui-egui/tests/it/shared_docking_ui.rs
#	crates/ui-egui/tests/it/ui_dock_resize.rs
#	crates/ui-egui/tests/it/ui_panel_windows.rs
#	crates/ui-egui/tests/it/ui_workspace_focus.rs
2026-10-25 18:06:51 +00:00
aiongg e5bb52cc35 craft-libs: pin every crate to 5bbe9f62 (craft-libs main with every shared docking fix) 2026-10-25 16:59:58 +00:00
aiongg 6ffb7778e9 craft-libs: pin every crate to d24e4bcc (Mac round 3: docking fixes, drop previews, native floats stay visible while inactive) 2026-10-25 14:02:31 +00:00
aiongg de86a67348 craft-libs: pin every crate to 27e60765 (a minimized floating OS window shrinks to its bar) 2026-10-25 13:29:54 +00:00
aiongg 0061eb6d5f craft-libs: pin every crate to a042cf26 (floating windows keep their ids; native key equivalents in floating text fields) 2026-10-25 08:07:28 +00:00
aiongg 85ffe0ca1c craft-libs: pin every crate to 8a503cfe (drop targets, craft-libs#310) 2026-10-25 04:42:39 +00:00
aiongg 038e5c03bf D1: panels dock in craft-ui's shared docking; craft-libs pinned to 2869b8cc
Every craft-libs crate and the hayro-syntax and hayro-jbig2 patches are
pinned to storytold/craft-libs 2869b8cc. The workspace is a craft-ui
Workspace<PanelKind>: craft-ui draws the frames, tab strips, stacked
panels, floating windows and drop previews and owns the gestures.
EffectCraft keeps PanelKind, its built-in workspaces, the panel bodies,
the Timeline's comp tabs, viewer locks and the panel menu in each group
header, and the rule that no move or float empties the docked area.

window.dockAction applies craft-ui Actions; craft-ui's window.panel.*
commands, ui.dock and ui.dock.reset parse as DockCommand. Saved
workspaces are version 2 snapshots of craft-ui Workspaces; an earlier
file loads as the default layout and is left untouched.
2026-10-25 03:23:32 +00:00
aiongg eb5108786b PDF: repin craft-pdf, hayro-syntax and hayro-jbig2 to craft-libs 9f75d3dc for its xref, object-stream, graphics-state and JBIG2 input bounds (#2265) 2026-10-23 23:27:29 -04:00
aiongg 2cca29830e Batch fix: EPS: load returns an operator value, so an executable-name alias runs what its name is bound to (#1909) 2026-10-24 01:43:40 +00:00
aiongg 80a08e3a3f Batch fix: pdf: the u32 overflow tests reach their fonts from the page, as the object loader needs (#2163) 2026-10-24 01:29:13 +00:00
aiongg c028b49f99 Batch fix: EPS: executable names count against the PostScript call depth 2026-10-24 01:23:26 +00:00
aiongg 69d6e3d28a Batch fix: EPS: filter keeps its source, so an image's data source isn't skipped twice (#1909) 2026-10-24 01:22:55 +00:00
aiongg fec95ff7ea Merge #1909: EPS: Illustrator EPS files draw their artwork (#955) (@JWesCampbell) 2026-10-24 01:21:39 +00:00
aiongg f50019244a Merge #2163: Fix u32 overflows in PDF CID width tables and CMap ranges (#2147) (@MarekSpodBiedry) 2026-10-24 01:21:39 +00:00
Dylan M. Taylor 8a4ed77c4a pdf: bound image sample and mask allocations (#2191)
* pdf: bound image sample and mask allocations

* pdf: fallible mask allocations and JPEG header pixel cap
2026-10-23 08:56:15 -04:00
MarekSpodBiedry a07eb51dbf Fix u32 overflows in PDF CID width tables and CMap ranges (#2147) 2026-10-22 21:10:05 +02:00
Wes CampbellandClaude Opus 5.5 a3d5e55bc7 EPS: Illustrator EPS files draw their artwork (#955)
Illustrator EPS imported as an empty layer. Three gaps in the PostScript
interpreter, each against the PostScript Language Reference:

- An operator stored under another name (`/mo /moveto load def`, as
  Illustrator's prolog does for every path and paint operator) pushed the
  operator's name instead of running it, so nothing was drawn.
- Device queries that return values (currentpagedevice, currentscreen,
  currentflat, currenthalftone, status, dictstack, ...) pushed nothing,
  shifting the stack under the procset's guards. They now push a plain
  device's defaults; setscreen pops its three operands.
- `currentfile 0 (eod) /SubFileDecode filter` now skips to the end-of-data
  string, so an embedded XMP packet isn't run as PostScript.

The regression test uses synthetic PostScript only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 14:33:59 -05:00
Brandon Thomas da1b44e44a Merge pull request #1527 2026-10-18 09:35:34 -04:00
BFlat 8f02f52a44 Merge pull request #1478 from midasmatterhorn/fix/cff-endchar-width-polarity
pdf: endchar takes its width by operand parity like the stems and rmoveto
2026-10-16 19:05:24 +07:00
bflatastic 9bdf05f34b Merge main into #1478; keep both sides of crates/pdf/src/cff.rs 2026-10-16 19:04:43 +07:00
bflatastic e37eec904d Merge main into #1565; keep both sides of crates/pdf/src/tests_import.rs 2026-10-16 19:04:34 +07:00
bflatastic 3ec09f20d4 Merge remote-tracking branch 'origin/main' into pr-1482
# Conflicts:
#	crates/pdf/src/cff.rs
2026-10-16 18:14:31 +07:00
BFlat 5bbd982c32 Merge pull request #1566 from midasmatterhorn/fix/r4-inline-len-overflow
pdf: an inline image with absurd dimensions falls back to the EI scan
2026-10-16 18:13:33 +07:00
BFlat 79bfc23c69 Merge pull request #1447 from midasmatterhorn/fix/glyph-name-char-boundary
pdf: don't slice glyph names at a non-char boundary in name_to_unicode
2026-10-16 18:12:24 +07:00
BFlat 896710b4c9 Merge pull request #1477 from midasmatterhorn/fix/cff-seac-recursion-depth
pdf: bound CFF endchar seac recursion so a cyclic font can't overflow the stack
2026-10-16 18:10:19 +07:00
bflatasticandClaude Opus 5.5 6f2f98b398 pdf: inline_len returns the checked product directly (clippy)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 17:48:08 +07:00
bflatasticandClaude Opus 5.5 f8b587503d pdf: rustfmt the inline-image test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 17:36:55 +07:00
bflatasticandClaude Opus 5.5 183fe652e4 pdf: an inline image just under usize::MAX bytes doesn't overflow its end offset
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 17:36:11 +07:00
BFlat c044e7a872 Merge pull request #1543 from arnav-hiwarkar/fix/1536-ai-retain-layer-sizes
Import: Composition - Retain Layer Sizes for PDF / Illustrator files (#1536)
2026-10-16 17:02:43 +07:00
skylar taylor-barrickandCodex c2f790b1d9 refactor(pdf): share structure parsing through a bounded adapter
Load PDF document objects through the pinned craft-pdf parser and convert them into EffectCraft's existing drawing model with bounded traversal, recovery and retained data. Preserve generation numbers, stream limits, encrypted-document refusal and reported repairs.

Retain app-owned drawing, EPS, fonts and content/image decoding. Assert early excessive-nesting rejection without partial art, and cover tolerant arrays on native and WASM.

Validated with the22-stage local matrix and exact-head FreeBSD, Windows ARM64 and packaging checks.

Co-authored-by: Codex <noreply@openai.com>
2026-10-15 16:35:49 -06:00
midasmatterhorn 5e18a7fd92 pdf: an inline image with absurd dimensions falls back to the EI scan
inline_len computed (w * n * bpc).div_ceil(8) * h with Width/Height taken
straight from the content stream and no size validation — unlike decode()
and mask_image, which bound their geometry first. /W 5000000000000000000
overflows the multiply in debug and test builds; in release it wraps to a
small length and the caller slices the wrong bytes, misparsing the image
and shifting the EI resync.

Chain the arithmetic through checked_mul and return None, which the
caller already routes to the EI-scan fallback. Regression test:
inline_image_with_absurd_dimensions_falls_back_to_ei_scan — panics at
crates/pdf/src/image.rs:85 on main, passes with the chain.
2026-10-15 16:10:10 +03:00
midasmatterhorn 400379fd20 pdf: a soft mask at an unsupported bit depth is ignored, not fatal
mask_image read /BitsPerComponent from the attacker-controlled /SMask
dict with no validation and fed it straight into 1u32 << bpc — the main
image path rejects anything but 1|2|4|8|16 before its own identical
shift, the mask path did not. /BitsPerComponent 32 panics in debug and
test builds and wraps the shift in release, mistranslating every sample
into alpha.

Mirror decode()'s depth check: an unsupported mask depth means no usable
mask, so the image draws with the mask treated as absent. Regression
test: smask_with_absurd_bpc_is_ignored_not_fatal — panics at
crates/pdf/src/image.rs:184 on main, passes with the check.
2026-10-15 16:05:32 +03:00
.CooCoo 26ed1a35bf fix(pdf): prevent overflow in EPS integer arithmetic
Use checked division and remainder for EPS integer operators so i64::MIN with a divisor truncating to -1 cannot panic. Preserve the existing zero-divisor fallback and normal truncation behavior.

Add public EPS parse regressions covering extreme, fractional and ordinary operands.

PR #1223
2026-10-15 02:09:25 -06:00
arnav-hiwarkarandClaude Opus 5.5 2d216151c6 Import: Composition - Retain Layer Sizes for PDF / Illustrator files (#1536)
The PDF / Illustrator import dialog now offers Composition - Retain Layer
Sizes. Each file layer's footage is cropped to its artwork bounds (fills,
stroke outlines, images, clips) and positioned to keep its place on the
page. Decoding, continuous rasterisation, shape conversion and reload share
one crop (effectcraft_pdf::layer_doc_with_sizes), so they agree.

Also collapses a match guard in the STL reader for current stable clippy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 13:33:50 +05:30
midasmatterhorn c6736d8fc0 pdf: checked_add for CFF Private DICT and Type 1 RD offsets from the file 2026-10-14 22:57:37 +03:00
midasmatterhorn 790e2387d6 pdf: endchar takes its width by operand parity like the stems and rmoveto 2026-10-14 22:56:27 +03:00