A zero-width PPM image crashes Pillow's morphology code
Pillow: Out-of-bounds access in _imagingmorph on a zero-width image
- Advisory
- CVE-2026-112397
- Library
- Pillow, pillow on PyPI
- Published
- Severity
- not scored upstream
- Affected
- < 12.3.0
- Fixed in
- 12.3.0
- Reaches you
- through another call
What triggers it
Image.open on a PPM or PGM file declaring a width of 0, then ImageMorph.MorphOp.apply on it.
What sillybos does
Refused by default
sillybos refuses the triggering file under its default policy, through the format check.
A PPM file is not one of the four formats a scan can be and is refused as an unknown format; a zero dimension is refused in the formats sillybos does read. The crash itself is in a morphology call opening a file never makes.
Proposed from the advisory's text on 2026-11-01, as part of folding the backfill into the record; confirmed by a person on 2026-11-03.
Proved by these tests in the sillybos suite, each of which builds the triggering file from bytes and checks that it is refused:
tests/test_check.py::TestHostileFiles::test_an_unknown_formattests/test_check.py::TestHostileFiles::test_an_image_with_a_zero_dimension
How to protect yourself
In general. Upgrade to Pillow 12.3.0.
Specifically. Open with formats limited to the readers you mean to use, as open_checked does.
The general advice applies to every row here.
Sources
- https://osv.dev/vulnerability/GHSA-58r4-6rv3-gfh8
- https://osv.dev/vulnerability/PYSEC-2026-4329
- The record entry, triaged 2026-11-03, last checked 2026-11-03