---
id: "CVE-2026-125218"
page: "https://infrastack.ai/live/CVE-2026-125218"
kind: "vulnerability"
aliases: ["CVE-2026-125218"]
title: "FFmpeg: crafted media with mid-stream resolution change overflows heap"
severity: "high"
cvss: 7.3
epss: null
exploited: false
status: "open"
category: "runtime"
products: [{"name": "ffmpeg", "fixed": [], "affected": "<= 9.0.2", "ecosystem": "vendor"}]
ecosystems: []
tags: ["ffmpeg", "media-transcoding", "runtime", "self-hosted"]
not_affected_if: ["apng-not-used", "no-untrusted-media"]
published_at: "2026-11-09T19:16:59+00:00"
first_seen_at: "2026-11-09T19:28:19+00:00"
updated_at: "2026-11-09T19:33:52+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-125218", "first_seen_at": "2026-11-09T19:28:19+00:00"}, {"source": "analyst", "url": null, "first_seen_at": "2026-11-09T19:33:52+00:00"}]
exploit_sources: []
---

# FFmpeg: crafted media with mid-stream resolution change overflows heap

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

FFmpeg's APNG encoder, in encode_apng() in libavcodec/pngenc.c, writes past a heap buffer when the frame size changes mid-stream. An attacker who supplies crafted media can crash transcoding applications or corrupt heap memory.

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

## Affected

- vendor:ffmpeg affected <= 9.0.2 fixed no fixed version listed

## How to check

- Run `ffmpeg -version`; 9.0.2 and earlier are affected per VulnCheck.
- Find services that transcode user-supplied media and encode to APNG (-c:v apng or .apng output) with changing resolution mid-stream.
- Check whether your build includes commit 9b99973b (git merge-base --is-ancestor 9b99973b <your-ref>).

## Fix

Upstream commit 9b99973b2bbecee0b7e1e57035b95498b42f54a6 (avcodec/encode: reject video frames larger than the encoder too). No fixed release named yet; versions through 9.0.2 are affected. Build from a source that includes the commit, or check the FFmpeg release notes for a release after 9.0.2.

## Timeline

- 2026-11-09T19:28:19+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-125218
- 2026-11-09T19:33:52+00:00 analyst — Upstream commit 9b99973b (michaelni) fixes in libavcodec/encode.c (generic check: reject any frame whose size differs from encoder context), not pngenc.c, so the guard is not APNG-specific. No release containing it was named in the sources I could read (web-cli out of credits; commit page via WebFetch). Fixed release unknown; nothing verified.

## Documents

- [advisory] Third-party advisory: www.vulncheck.com https://www.vulncheck.com/advisories/ffmpeg-through-9.0.2-apng-encoder-heap-buffer-overflow-via-encode-apng
- [fix] Patch: github.com https://github.com/FFmpeg/FFmpeg/commit/9b99973b2bbecee0b7e1e57035b95498b42f54a6

## From the sources

FFmpeg through 9.0.2 contains a heap buffer overflow vulnerability in the APNG encoder's encode_apng() function in libavcodec/pngenc.c when frame size changes mid-stream. Attackers can supply crafted media whose resolution grows mid-stream, causing APNG_DISPOSE_OP_BACKGROUND memset writes past prev_frame and crashing or corrupting heap memory in transcoding applications.

---

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