mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-02 22:41:47 -06:00
Four ways round the allowance, each measured by a review of hostile input: A Flate stream read as zlib that fails at once, and then as raw deflate that decodes everything before failing, gave nothing back and so was charged nothing, here and in DecodeBudget: 110 s for a 387 KB file, all decoded. What the retry decoded now counts, though the data is still dropped as it was. Fax and 1-bit Flate images paid by the byte for work done by the pixel: 19 bytes can be a blank page of 100 million pixels, about a second each. Every image decoded here now pays for its pixels first, as JBIG2 already did. A JPEG paid nothing, and what one asks for doesn't grow with its length: 156 bytes declared 80 megapixels, 72 s for an 8 KB file. A JPEG pays for its samples before it is decoded, in Optimize and in an export that has to decode one for its mask. Merging fragments paid for reading strips and not for the picture it built: 393 s for 1,154 bytes. It pays for the picture before allocating it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY