mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-13 23:08:09 +00:00
photocraft-affinity now reads native Affinity documents (container versions 8-12): the FAT and revision chain, stored/zlib/zstd entries with predictors and CRC checks, the tagged object stream in doc.dat, and the document model (pages, artboards, layers, groups, curves, geometric and compound shapes, fills, gradients, strokes, text, placed images, pixel layers, masks and embedded-document caches). Every size is bounded and malformed input returns an error. photocraft-io maps it to an RGB8 document with artboards, groups, shape layers, type layers, embedded smart objects, pixel layers and vector/layer masks; what can't be mapped is listed in the warnings. The embedded preview is now only a fallback when the native data can't be read, and only that preview is refused by Place and warningless imports. `cargo xtask corpus --affinity` pins 21 public CC0/MIT documents, sha256-verified; the io corpus test compares each import with the thumbnail Affinity saved in it (mean difference 0-4.6 of 255). Affinity export is not implemented: no Affinity installation was available to validate written files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GQPh8UDgMyARR5Hat9UchC
11 lines
267 B
Rust
11 lines
267 B
Rust
#![no_main]
|
|
|
|
use libfuzzer_sys::fuzz_target;
|
|
|
|
fuzz_target!(|data: &[u8]| {
|
|
// The complete import: native document mapping, or the preview fallback.
|
|
if photocraft_affinity::is_affinity(data) {
|
|
let _ = photocraft_io::import("fuzz.af", data);
|
|
}
|
|
});
|