---
id: CVE-2026-112397
title: 'Pillow: Out-of-bounds access in _imagingmorph on a zero-width image'
summary: >-
  Pillow is a Python imaging library. Prior to 13.0.0, Pillow's
  ImageMorph.MorphOp.apply() can access memory before a row buffer for a
  zero-width image. PPM and PGM input can create an image with width zero, and
  the native morphology routi…
severity: high
cvss: 8.7
cvssVector: 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N'
cvssSource: cna
cwe:
  - CWE-787
vendor: python-pillow
product: Pillow
affected:
  - Pillow < 13.0.0
ssvc:
  exploitation: poc
  automatable: 'yes'
  technicalImpact: partial
  timestamp: '2026-10-19T21:37:56.314774Z'
exploitAvailable: true
published: '2026-10-19'
updated: '2026-10-19'
sourceUpdated: '2026-10-19T21:38:18.176Z'
source: CVEORG
sourceUrl: 'https://www.cve.org/CVERecord?id=CVE-2026-112397'
references:
  - url: >-
      https://github.com/python-pillow/Pillow/security/advisories/GHSA-58r4-6rv3-gfh8
    label: >-
      https://github.com/python-pillow/Pillow/security/advisories/GHSA-58r4-6rv3-gfh8
  - url: >-
      https://github.com/python-pillow/Pillow/commit/18f7c0dfee93063c51db6ed0ca8c4da2999dcb64
    label: >-
      https://github.com/python-pillow/Pillow/commit/18f7c0dfee93063c51db6ed0ca8c4da2999dcb64
  - url: 'https://github.com/python-pillow/Pillow/releases/tag/13.0.0'
    label: 'https://github.com/python-pillow/Pillow/releases/tag/13.0.0'
tags:
  - cve.org
  - exploit-available
ingestedAt: '2026-10-19T21:43:56.110Z'
---

## Overview

Pillow is a Python imaging library. Prior to 13.0.0, Pillow's ImageMorph.MorphOp.apply() can access memory before a row buffer for a zero-width image. PPM and PGM input can create an image with width zero, and the native morphology routine indexes outrow[width - 1] without rejecting that geometry. An attacker can supply such an image to an application that applies a morphology operation. This can crash the process. This issue is fixed in version 13.0.0.

## Affected

- `Pillow < 13.0.0`

## Remediation

Refer to the linked advisories for vendor-supplied fixes and affected version ranges.
