---
id: "CVE-2026-125227"
page: "https://infrastack.ai/live/CVE-2026-125227"
kind: "vulnerability"
aliases: ["CVE-2026-125227"]
title: "FFmpeg: integer overflow in JPEG scan writer enables heap corruption"
severity: "high"
cvss: 7.3
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["32-bit", "ffmpeg", "libavcodec", "media-processing", "package"]
not_affected_if: ["64-bit-build", "no-cbs-filters", "no-untrusted-jpeg-input"]
published_at: "2026-11-09T19:17:00+00:00"
first_seen_at: "2026-11-09T19:28:19+00:00"
updated_at: "2026-11-09T19:29:57+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-125227", "first_seen_at": "2026-11-09T19:28:19+00:00"}]
exploit_sources: []
---

# FFmpeg: integer overflow in JPEG scan writer enables heap corruption

Link for people: https://infrastack.ai/live/CVE-2026-125227 (this .md is for agents)

FFmpeg's JPEG bitstream writer miscalculates buffer sizes for scans of 512 MiB or more on 32-bit builds, causing a heap buffer overflow. An attacker who supplies a crafted MJPEG or JPEG stream can corrupt the heap or crash the application.

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

## How to check

- Check whether FFmpeg or libavcodec is built for a 32-bit target, for example with `ffmpeg -version` showing a 32-bit configuration.
- Check whether the application runs CBS bitstream filters such as filter_units on untrusted JPEG or MJPEG input.

## Fix

- FFmpeg: the sources do not state a fixed version; the linked patch is on github.com.

## Timeline

- 2026-11-09T19:28:19+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-125227

## Documents

- [advisory] Third-party advisory: www.vulncheck.com https://www.vulncheck.com/advisories/ffmpeg-through-9.0.2-heap-buffer-overflow-via-cbs-jpeg-write-scan-integer-overflow
- [fix] Patch: github.com https://github.com/FFmpeg/FFmpeg/commit/b89ce54d93bf644433dfa9fbc34f19c22237691a

## From the sources

FFmpeg through 9.0.2 contains an integer overflow in cbs_jpeg_write_scan() in libavcodec/cbs_jpeg.c that causes a heap buffer overflow on 32-bit builds. Attackers can supply a crafted MJPEG/JPEG stream with a scan of 512 MiB or more, processed by CBS bitstream filters like filter_units, to corrupt the heap or crash the application.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
