---
id: CVE-2026-125218
title: FFmpeg through 9.0.2 APNG Encoder Heap Buffer Overflow via encode_apng()
summary: >-
  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-stre…
severity: high
cvss: 7
cvssVector: 'CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H'
cvssSource: cna
cwe:
  - CWE-122
vendor: FFmpeg
product: FFmpeg
affected:
  - FFmpeg <= 9.0.2
published: '2026-11-09'
updated: '2026-11-09'
sourceUpdated: '2026-11-09T19:11:33.101Z'
source: CVEORG
sourceUrl: 'https://www.cve.org/CVERecord?id=CVE-2026-125218'
references:
  - url: 'https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25682'
  - url: >-
      https://github.com/FFmpeg/FFmpeg/commit/9b99973b2bbecee0b7e1e57035b95498b42f54a6
    label: Patch Commit
  - url: 'https://github.com/FFmpeg/FFmpeg/blob/n9.0.2/libavcodec/pngenc.c#L1148'
  - url: 'https://github.com/FFmpeg/FFmpeg'
  - url: >-
      https://www.vulncheck.com/advisories/ffmpeg-through-9.0.2-apng-encoder-heap-buffer-overflow-via-encode-apng
    label: >-
      VulnCheck Advisory: FFmpeg through 9.0.2 APNG Encoder Heap Buffer Overflow
      via encode_apng()
tags:
  - cve.org
ingestedAt: '2026-11-09T19:18:02.591Z'
---

## Overview

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.

## Affected

- `FFmpeg <= 9.0.2`

## Remediation

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