---
id: CVE-2026-112891
title: 'Pillow: Quadratic GIF comment copying during save'
summary: >-
  Pillow is a Python imaging library. From 9.2.0 until 13.0.0, Pillow performs
  quadratic copying when saving a GIF with a long comment. _get_global_header()
  repeatedly copies portions of comment data while assembling the global header,
  inc…
severity: medium
cvss: 6.9
cvssVector: 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N'
cvssSource: cna
cwe:
  - CWE-407
vendor: python-pillow
product: Pillow
affected:
  - 'Pillow >= 9.2.0, < 13.0.0'
published: '2026-10-19'
updated: '2026-10-19'
sourceUpdated: '2026-10-19T21:33:32.180Z'
source: CVEORG
sourceUrl: 'https://www.cve.org/CVERecord?id=CVE-2026-112891'
references:
  - url: >-
      https://github.com/python-pillow/Pillow/security/advisories/GHSA-fc9g-5qg7-mf45
    label: >-
      https://github.com/python-pillow/Pillow/security/advisories/GHSA-fc9g-5qg7-mf45
  - url: >-
      https://github.com/python-pillow/Pillow/commit/68a3fe957d8a4d552e8c69d96066d749f0614c7e
    label: >-
      https://github.com/python-pillow/Pillow/commit/68a3fe957d8a4d552e8c69d96066d749f0614c7e
  - 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
ingestedAt: '2026-10-19T21:43:56.113Z'
---

## Overview

Pillow is a Python imaging library. From 9.2.0 until 13.0.0, Pillow performs quadratic copying when saving a GIF with a long comment. _get_global_header() repeatedly copies portions of comment data while assembling the global header, including comments retained from an untrusted input image. An attacker can supply an image with a large GIF comment to an application that saves it as GIF. This can consume excessive CPU and delay or deny service. This issue is fixed in version 13.0.0.

## Affected

- `Pillow >= 9.2.0, < 13.0.0`

## Remediation

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