mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-25 10:37:11 -06:00
A full-size load asks the decoder for the largest box (`SourceLevel::Full` is `usize::MAX`, cast to `u32::MAX`). `jpeg::decode` then computed `2 * u32::MAX` to decide on DCT scaling: an overflow panic in debug builds (caught, so every full-size JPEG load failed with "decoder panicked"), and a wrap that happened to give the right answer in release. The comparison saturates now, and the engine converts its `usize` edge with `u32::try_from` instead of a truncating `as`. Found decoding camera JPEGs (no JFIF/EXIF header) at full size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>