mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-09-20 20:48:06 +00:00
Limit individual allocator requests made by PNG decoders to the Kitty graphics protocol's 400 MiB image ceiling. Add a reusable allocator wrapper for callers that need per-request bounds. PNG decoding previously used Wuffs' 4 GiB package limit and checked the result only after allocation. A tiny PNG with oversized dimensions could cause a multi-gigabyte RSS spike before being rejected. Wrap decoder allocators with LimitedAllocator and translate limit rejections to invalid image data while preserving genuine out-of-memory errors. Add allocator boundary tests and regression coverage for a crafted PNG below Wuffs' limit.