---
id: "CVE-2026-125250"
page: "https://infrastack.ai/live/CVE-2026-125250"
kind: "vulnerability"
aliases: ["CVE-2026-125250"]
title: "FFmpeg: crafted PAL8 video overflows heap while encoding GIF"
severity: "high"
cvss: 8.5
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "ffmpeg", "fixed": [], "affected": "<= 9.0.2", "ecosystem": "vendor"}]
ecosystems: []
tags: ["ffmpeg", "media-transcoding", "package", "self-hosted"]
not_affected_if: ["no-gif-output", "no-user-uploads"]
published_at: "2026-11-09T19:17:03+00:00"
first_seen_at: "2026-11-09T19:28:21+00:00"
updated_at: "2026-11-09T19:30:36+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-125250", "first_seen_at": "2026-11-09T19:28:21+00:00"}, {"source": "analyst", "url": null, "first_seen_at": "2026-11-09T19:30:36+00:00"}]
exploit_sources: []
---

# FFmpeg: crafted PAL8 video overflows heap while encoding GIF

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

FFmpeg's GIF encoder sizes a buffer from the first frame's line length, so a video whose line length grows mid-stream makes it write past the buffer. An attacker who supplies such a file can corrupt memory during GIF transcoding, which can lead to code execution.

_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`; versions up to 9.0.2 are affected. Also check whether your build includes commit 26c2980 (`git tag --contains 26c2980` in a clone). Only matters if you encode to GIF (`-c:v gif` or .gif output) from untrusted input. Workaround until patched: do not accept untrusted video for GIF output.

## Fix

Fixed upstream in commit 26c2980980295e5516f308c5a2792d2a72e43eae (libavcodec/gif.c). No release containing it is named in the sources; use a build that includes the commit or a release after 9.0.2 once confirmed.

## Timeline

- 2026-11-09T19:28:21+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-125250
- 2026-11-09T19:30:36+00:00 analyst — Read FFmpeg commit 26c2980 (libavcodec/gif.c: shrunk_buf now width-strided; found by Joshua Rogers/AISLE) and VulnCheck advisory (FFmpeg <= 9.0.2, PAL8 with growing linesize, AV:L UI:P, no exploitation or PoC stated). No release containing the fix is named in either; web-cli out of credits so no release page checked. Nothing verified.

## Documents

- [advisory] Third-party advisory: www.vulncheck.com https://www.vulncheck.com/advisories/ffmpeg-through-9.0.2-gif-encoder-heap-buffer-overflow-via-shrunk-buf-remap
- [fix] Patch: github.com https://github.com/FFmpeg/FFmpeg/commit/26c2980980295e5516f308c5a2792d2a72e43eae

## From the sources

FFmpeg through 9.0.2 contains a heap buffer overflow in the GIF encoder's gif_image_write_image() in libavcodec/gif.c because shrunk_buf is sized from the first frame's linesize. Attackers can supply PAL8 video whose frame linesize grows mid-stream, causing remap_frame_to_palette() to write past shrunk_buf and corrupt the heap during GIF transcoding.

---

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