---
id: "CVE-2026-125255"
page: "https://infrastack.ai/live/CVE-2026-125255"
kind: "vulnerability"
aliases: ["CVE-2026-125255"]
title: "FFmpeg: crafted MJPEG stream triggers use-after-free and heap leak"
severity: "medium"
cvss: 5.8
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["ffmpeg", "libavcodec", "media-processing", "mjpeg", "package"]
not_affected_if: ["no-mjpeg-decoding", "trusted-input-only"]
published_at: "2026-11-09T20:18:11+00:00"
first_seen_at: "2026-11-09T20:48:13+00:00"
updated_at: "2026-11-09T20:49:52+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-125255", "first_seen_at": "2026-11-09T20:48:13+00:00"}]
exploit_sources: []
---

# FFmpeg: crafted MJPEG stream triggers use-after-free and heap leak

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

FFmpeg's MJPEG decoder in libavcodec can read a freed buffer when a stream sends a start-of-frame marker without a preceding start-of-image marker. A crafted MJPEG file or stream can crash the application or leak heap memory contents.

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

## How to check

- Check the FFmpeg version with `ffmpeg -version`; the sources say versions through 9.0.2 are affected.
- Find where FFmpeg or libavcodec is embedded in your applications, including bundled builds, and check their versions.

## Timeline

- 2026-11-09T20:48:13+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-125255

## Documents

- [advisory] Third-party advisory: www.vulncheck.com https://www.vulncheck.com/advisories/ffmpeg-through-9.0.2-use-after-free-in-mjpeg-hardware-accelerated-decoding
- [fix] Patch: github.com https://github.com/FFmpeg/FFmpeg/commit/f58a6776546567367baf5223df9ffbfd289299f8

## From the sources

FFmpeg through 9.0.2 contains a use after free vulnerability in libavcodec/mjpegdec.c that allows attackers to trigger freed buffer reads by sending a SOF marker without a preceding SOI. Attackers can supply crafted MJPEG streams causing ff_mjpeg_decode_sof() to pass a stale raw_image_buffer pointer to hwaccel decoders like NVDEC, crashing applications or leaking heap contents.

---

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