mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-12 21:23:02 +00:00
The pre-decode SOF scan read every JPEG strip or tile from its start, so chunks that overlap (65536 tiles over the same 512 KiB without a 0xFF) made opening a file step through tens of billions of bytes. The walk now takes one step per byte it steps over, from a budget of the file's length plus 64 steps per chunk shared by every chunk and JPEGTables. Chunks that don't overlap fit in the file's length; running out refuses the image with InvalidImage. A JPEG chunk with no SOF is now charged its compressed stream, which the tiff crate copies whole before zune-jpeg reads it, and the floating-point predictor row is charged for strips too (the tiff crate decodes a strip row by row when it holds samples it does not return). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>