mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-24 10:09:01 -06:00
scan_for_jpeg walks every JPEG-like start in a container it can't parse; each walk runs through the marker segments that follow (up to 4096) and their entropy data. A crafted CRW/MRW/X3F (or unsupported TIFF raw) of fake starts one after another makes every walk cover most of the file: quadratic, about a minute for 40 MB, on the import's probe thread. The walks now report how far they read and share a budget of eight times the file's size (at least 1 MiB); real files' candidates fail within a few bytes or are the preview itself. Test: 200,000 fake starts, 0.15 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01912WaK6Rmew3wxZuPyX7E8