mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-24 09:57:08 -06:00
Cryptomatte metadata enumeration had two file-driven amplifiers: - cryptomatte_keys() tested key membership with iter().any(), O(n^2) in the number of distinct cryptomatte/<key>/<field> attribute groups; - layers() called layer_streams() for every key, rescanning all channels and allocating a fresh owned stream list even when many keys name the same layer. Use a HashSet for key membership (keeping file order) and cache layer_streams results by resolved layer name within each header, so repeated keys reuse the discovered streams. Findings: - 120f4d51-b981-4fcc-abec-26f45f3efd29 (CWE-407, quadratic key membership) - dae6e76b-a491-4089-892f-4cf34b911f36 (CWE-400, repeated per-key stream scans)