CVE-2026-112402: Pillow: Double free in ImagingScaleAffine on calloc failure via Image.transform
Pillow is a Python imaging library. Prior to 13.0.0, Pillow can double free image memory when ImagingScaleAffine encounters a selective allocation failure. The affected fast path handles Transform.EXTENT or pure scale-and-translate Transform.AFFINE operations with the default NEAREST resampling. The output image allocation must succeed while the additional per-column lookup allocation fails, after which the error path deletes image storage that later cleanup releases again. An attacker who can drive such a large Image.transform() operation under memory pressure may trigger the failure. This can crash the process and may corrupt memory. This issue is fixed in version 13.0.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Pillowto a version that resolves this vulnerability.Fixed in 13.0.0
Event History
Frequently Asked Questions
Which deployments are most likely to be exposed?
Deployments using Pillow before 13.0.0 that process attacker-controlled images or allow attackers to influence Image.transform() parameters are the relevant exposure cases. Exploitation specifically requires a large transform to run while the process is under memory pressure.
What transform settings reach the affected code path?
The affected fast path is used for Transform.EXTENT and for pure scale-and-translate Transform.AFFINE operations when using the default NEAREST resampling. Other transform types or resampling settings are not identified as affected by the provided information.
Does exploitation require authentication or user interaction?
The CVSS vector indicates no privileges and no user interaction are required. An attacker must nevertheless be able to cause the application to perform a qualifying large Image.transform() operation and induce the required selective allocation failure.
What can be done if upgrading is not immediately possible?
Avoid or restrict large Image.transform() operations using Transform.EXTENT or pure scale-and-translate Transform.AFFINE with NEAREST resampling, especially for attacker-influenced inputs. Reducing memory pressure can also reduce the specific allocation-failure condition required for the bug.
How can I determine whether an application is affected?
Check whether it uses Pillow versions earlier than 13.0.0 and invokes Image.transform() with the affected transform and resampling conditions. Affected executions require the output image allocation to succeed while the additional per-column lookup allocation fails.