CVE-2026-112394: Pillow: P;2L and P;4L decoders may read 1 to 3 bytes past the passed buffer size
Pillow is a Python imaging library. Prior to 13.0.0, Pillow's P;2L and P;4L raw decoders can read past the end of an input buffer. ImagingRawDecode calculates a packed-pixel row size, while the unpackers read separately padded bit planes. A caller can supply a buffer and image dimensions whose accepted size is smaller than the unpacker's actual footprint. This can disclose up to three adjacent heap bytes in output pixels or crash the process. 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
Who is exposed to this issue?
Applications using Pillow versions before 13.0.0 are affected when they invoke the P;2L or P;4L raw decoders with attacker-controlled or otherwise untrusted buffer content and image dimensions.
What can an attacker do, and what access is required?
An unauthenticated attacker may be able to supply a crafted buffer and dimensions that pass the initial size check but cause reads beyond the buffer. This can expose up to three adjacent heap bytes through output pixels or crash the process.
Is there a fix?
Upgrade Pillow to version 13.0.0, which fixes the P;2L and P;4L raw decoder out-of-bounds read.
What is the risk if patching cannot happen immediately?
Avoid processing untrusted inputs through the P;2L and P;4L raw decoders, particularly where callers can control both the input buffer and image dimensions. The described impact is limited to disclosure of up to three adjacent heap bytes or process crashes.