mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-27 17:51:59 +01:00
An animated WebP used to bring only its first frame into a video layer. Now New Video Layer from File, Replace Footage, Reload Frame and Video Frames to Layers take every frame, as they do for an animated GIF (#572): - photocraft-codecs: `decode_webp_frames` returns each frame composited onto the canvas by image-webp (offsets, blending, disposal), with its duration in milliseconds and the file's ICC profile. A still WebP is one frame, read as `decode` reads it. A damaged later frame keeps the frames before it and marks the first `Truncated`; the frame count and total bytes are checked against `Limits`. `webp_is_animated` tells the two apart. New `decode_webp` fuzz target. - photocraft-io: `import_webp_frames`, sharing `import_gif_frames`' loop. - photocraft-engine: `load_frames` takes an animated WebP's frames; the timeline rate comes from the most common duration. A still WebP keeps the existing path and the 30 fps default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
14 lines
443 B
Rust
14 lines
443 B
Rust
#![no_main]
|
|
|
|
use libfuzzer_sys::fuzz_target;
|
|
use photocraft_codecs::{decode_as_with, decode_webp_frames, DecodeOptions, Format, Limits};
|
|
|
|
fuzz_target!(|data: &[u8]| {
|
|
let opts = DecodeOptions {
|
|
limits: Limits { max_width: 4096, max_height: 4096, max_pixels: 1 << 22, max_alloc: 256 << 20 },
|
|
..Default::default()
|
|
};
|
|
let _ = decode_as_with(Format::WebP, data, &opts);
|
|
let _ = decode_webp_frames(data, &opts);
|
|
});
|