Tetrak
GitHub ↗
Security · Pillow

A TIFF with short JPEG strips returns uninitialised memory as pixels

Pillow: TiffDecode returns uninitialized memory as pixels for short JPEG strips

Advisory
CVE-2026-112897
Library
Pillow, pillow on PyPI
Published
Severity
not scored upstream
Affected
< 12.3.0
Fixed in
12.3.0
Reaches you
by opening a file

What triggers it

Opening and loading a small crafted JPEG-compressed TIFF whose strips hold less data than a strip needs.

What sillybos does

Refused with a setting

sillybos refuses the triggering file when the policy says so (Policy(tiff_compressions=frozenset({"none", "ccitt", "lzw", "deflate", "packbits"}))); the default policy lets it through.

The carrier is a JPEG-compressed TIFF whose strip byte counts are short, and the shortfall only shows when a strip is decoded, which no header check does. But the compression is in the header, and a policy without jpeg in tiff_compressions refuses the file before libtiff sees it. The default allows JPEG in a TIFF, since scanners write it, so the setting is what closes this, at the cost of refusing real JPEG-in-TIFF scans.

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. Re-bucketed on 2026-11-03: the carrier is refused by a setting.

Proved by this test in the sillybos suite, which builds the triggering file from bytes and checks that it is refused:

How to protect yourself

In general. Upgrade to Pillow 12.3.0.

Specifically. Where the source never writes JPEG-in-TIFF, take jpeg out of tiff_compressions; otherwise upgrade Pillow and render in a boxed process.

The general advice applies to every row here.

Sources