Heap Buffer Overflow in Pillow Python Imaging Library
CVE-2026-42309
5.1MEDIUM
What is CVE-2026-42309?
The Pillow Python imaging library, from versions 11.2.1 to before 12.2.0, is susceptible to a heap buffer overflow due to improper handling of nested lists as coordinates in APIs, including ImagePath.Path, ImageDraw.ImageDraw.polygon, and ImageDraw.ImageDraw.line. When nested lists are used, they are recursively unpacked beyond the allocated buffer, creating a potential security risk. To mitigate this vulnerability, coordinate lists are now validated to ensure they contain exactly two numeric coordinates. The issue has been addressed and patched in version 12.2.0.
Affected Version(s)
Pillow >= 11.2.1, < 12.2.0
