---
id: "CVE-2026-120252"
kind: "vulnerability"
aliases: ["CVE-2026-120252"]
title: "imagecodecs: crafted lossless JPEG overflows stack and crashes the process"
severity: "medium"
cvss: 6.8
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["imagecodecs", "package", "python"]
not_affected_if: ["lossless-jpeg-unused", "trusted-input-only"]
published_at: "2026-11-01T01:17:19+00:00"
first_seen_at: "2026-11-01T01:47:22+00:00"
updated_at: "2026-11-01T01:47:34+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-120252", "first_seen_at": "2026-11-01T01:47:22+00:00"}]
---

# imagecodecs: crafted lossless JPEG overflows stack and crashes the process

imagecodecs is a Python library for decoding image formats, and its lossless JPEG decoder mishandles a crafted Define Huffman Table segment. A specially crafted lossless JPEG overflows a stack buffer in decode_jpegsof3() and crashes the calling process.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Check the installed version with `pip show imagecodecs` and see whether it falls in 2023.1.23 through 2026.10.10.
- Search dependency manifests and lockfiles for `imagecodecs` to find services that decode untrusted JPEG input.

## Timeline

- 2026-11-01T01:47:22+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-120252

## From the sources

imagecodecs 2023.1.23 through 2026.10.10 contains a stack-based buffer overflow vulnerability in the lossless JPEG Define Huffman Table parser in decode_jpegsof3(). Attackers can supply a crafted lossless JPEG whose DHT symbol counts wrap an 8-bit sum, overflowing the 32-entry HufVal and HufSz stack arrays and crashing the calling process.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
