mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-21 09:26:43 +00:00
The exr crate sizes a preview attribute's pixel buffer from its declared dimensions (up to 4 MiB at once, zero-filled) before it finds the attribute too short, and in the non-pedantic mode every reader here uses, it then skips the attribute and continues. A header with thousands of tiny malformed previews therefore cost thousands of 4 MiB allocations before any size check ran. check_previews walks the raw headers and refuses a preview whose declared width x height x 4 exceeds its value size. It runs before every header read: read_meta, read_layer, the Cryptomatte listing and decode_deep_exr.