Files
pdfcraft/Cargo.toml
T
Brandon ThomasandClaude Opus 5.5 1449b71a19 Never crash: bound the allocations behind the nightly fuzz runner's out-of-memory deaths
Fuzzed inputs drove one check-one process to 2-6 GB (the 16 GB CI runner
running two of them was killed every night). Three causes, each with a test:
- lopdf (bootstrap inspector) sized PNG predictor rows from /Columns before
  reading data: /Columns 4294967295 allocated two 4 GiB rows. Vendored lopdf
  0.45.0 refuses rows longer than the data (and uses saturating row widths);
  its load-time stream decoding also gets a 256 MiB limit (it had none).
- hayro sized a tiling pattern's cell pixmap from /XStep x scale, bounded only
  by u16: a step far beyond /BBox allocated 2 GB. The vendored patch keeps
  the cell within 3000 px a side, lowering the resolution instead.
- cos decoded cross-reference streams up to the general 1 GiB limit; they now
  stop at what 8,388,607 objects' rows can hold (~200 MB at most), and the
  section is reconstructed (logged) instead.

On the nightly's seed (41) the worst captured input fell from 6.2 GB to 6 MB,
and a 300 s fuzz run had no process above 300 MB (before: many at 2-5 GB).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 17:59:25 -04:00

91 lines
3.1 KiB
TOML

[workspace]
resolver = "3"
members = ["crates/*", "apps/*", "xtask"]
exclude = ["vendor"]
default-members = ["crates/*", "apps/printcraft", "apps/printcraft-cli", "xtask"]
[workspace.package]
version = "0.1.1"
edition = "2024"
license = "MIT OR Apache-2.0"
rust-version = "1.90"
repository = "https://github.com/storytold/printcraft"
[workspace.dependencies]
# internal
printcraft-geom = { path = "crates/geom", version = "0.1.0" }
printcraft-filters = { path = "crates/filters", version = "0.1.0" }
printcraft-cos = { path = "crates/cos", version = "0.1.0" }
printcraft-crypt = { path = "crates/crypt", version = "0.1.0" }
printcraft-organize = { path = "crates/organize", version = "0.1.0" }
printcraft-annot = { path = "crates/annot", version = "0.1.0" }
printcraft-fonts = { path = "crates/fonts", version = "0.1.0" }
printcraft-model = { path = "crates/model", version = "0.1.0" }
printcraft-content = { path = "crates/content", version = "0.1.0" }
printcraft-redact = { path = "crates/redact", version = "0.1.0" }
printcraft-print = { path = "crates/print", version = "0.1.0" }
printcraft-xfdf = { path = "crates/xfdf", version = "0.1.0" }
printcraft-sign = { path = "crates/sign", version = "0.1.0" }
printcraft-optimize = { path = "crates/optimize", version = "0.1.0" }
printcraft-a11y = { path = "crates/a11y", version = "0.1.0" }
printcraft-ocr = { path = "crates/ocr", version = "0.1.0" }
printcraft-js = { path = "crates/js", version = "0.1.0" }
printcraft-compare = { path = "crates/compare", version = "0.1.0" }
printcraft-preflight = { path = "crates/preflight", version = "0.1.0" }
printcraft-export = { path = "crates/export", version = "0.1.0" }
printcraft-edit = { path = "crates/edit", version = "0.1.0" }
printcraft-create = { path = "crates/create", version = "0.1.0" }
printcraft-forms = { path = "crates/forms", version = "0.1.0" }
printcraft-render = { path = "crates/render", version = "0.1.0" }
printcraft-engine = { path = "crates/engine", version = "0.1.0" }
printcraft-ui-egui = { path = "crates/ui-egui", version = "0.1.0" }
printcraft-automation = { path = "crates/automation", version = "0.1.0", default-features = false }
# pdf
hayro = "0.7.1"
hayro-syntax = "0.7.2"
lopdf = "0.45"
flate2 = { version = "1.1", default-features = false, features = ["rust_backend"] }
weezl = "0.2"
# foundation
thiserror = "2"
serde = { version = "1", features = ["derive", "rc"] }
serde_json = "1"
log = "0.4"
kurbo = "0.13"
# testing
proptest = "1"
# ui
egui = "0.36"
egui_extras = { version = "0.36", default-features = false, features = ["svg"] }
eframe = { version = "0.36", default-features = false }
egui_kittest = "0.36"
rfd = "0.17"
[workspace.lints.rust]
unsafe_code = "forbid"
[workspace.lints.clippy]
dbg_macro = "warn"
todo = "warn"
[profile.dev.package."*"]
opt-level = 2
[profile.dev]
opt-level = 1
[profile.release]
lto = "thin"
codegen-units = 1
# Vendored, patched third-party crates (see vendor/README.md). Each patch is meant to go upstream.
[patch.crates-io]
hayro-interpret = { path = "vendor/hayro-interpret" }
hayro = { path = "vendor/hayro" }
hayro-syntax = { path = "vendor/hayro-syntax" }
lopdf = { path = "vendor/lopdf" }