mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-25 10:36:56 -06:00
Layer bounds come straight from the file as four i32s. Rect::width/height subtracted them in i32 (overflow: a panic in debug builds, garbage sizes in release), and layer_pixels allocated width x height pixels before reading any data, so a 100-byte file claiming a 2^31-square layer hit "capacity overflow" (or an out-of-memory abort). Widths are now computed in i64 and clamped, every decoded image is capped at 2^28 pixels (Error::Unsupported beyond that), zlib data is inflated with a limit of the expected size, RLE count tables and UTF-16 strings reserve no more than the remaining bytes, and the per-pixel copy only visits the part of the layer that lands in the output. Denies the panic lints in the crate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>