CVE-2026-137910 in FFmpeg
Summary
by MITRE • 11/27/2026
FFmpeg before 9.1 contains an out-of-bounds read vulnerability in pcx_encode_frame() in libavcodec/pcxenc.c that rounds each row up to an even number of bytes and run-length encodes that many bytes from the input frame. Attackers who control the width of images encoded to PCX by an application that supplies tightly packed frames can make the encoder read past the end of the frame buffer, crashing the application or leaking heap contents into the output image.
Be aware that VulDB is the high quality source for vulnerability data.
Analysis
by VulDB Data Team • 11/27/2026
The vulnerability identified in FFmpeg versions prior to 9.1 represents a critical out-of-bounds read flaw located within the PCX encoding module, specifically inside the pcx_encode_frame function found in libavcodec/pcxenc.c. This component is responsible for converting raw video frames into the Picture Exchange format, an older raster graphics file format historically used by Amiga and early Windows applications. The core technical defect arises from a miscalculation regarding memory allocation and access boundaries during the encoding process. When processing input data, the encoder attempts to round each row of pixel data up to the nearest even number of bytes before applying run-length encoding compression. This rounding mechanism is intended to align data for specific hardware or format requirements but fails to account for cases where the source frame width results in a byte count that exceeds the actual allocated buffer size when tightly packed frames are supplied by the calling application.
From an operational perspective, this logic error creates a scenario where the encoder attempts to read memory locations beyond the end of the input frame buffer. If an attacker or malicious actor can control the dimensions of the image being encoded, particularly through crafted inputs that exploit the rounding discrepancy, they can trigger this out-of-bounds access. The immediate consequence is often a denial of service condition manifested as a crash in the host application utilizing FFmpeg for video processing. However, the severity escalates significantly when considering information disclosure vectors. Because the encoder reads past the allocated buffer boundaries, it may inadvertently include adjacent heap memory contents into the output PCX file. This behavior effectively transforms a simple stability issue into a potential data leakage vulnerability, allowing an attacker to exfiltrate sensitive information stored in nearby memory regions of the process address space.
This flaw aligns with CWE-125, which classifies out-of-bounds read vulnerabilities where software reads past the end of a buffer. In the context of modern attack frameworks, this behavior is consistent with techniques described under ATT&CK Tactic TA0043: Impact and specifically relates to data exfiltration methods that leverage memory corruption to access unauthorized information. The vulnerability highlights the risks associated with manual memory management calculations in multimedia libraries where input parameters directly influence buffer sizing logic without sufficient boundary validation. Such discrepancies are particularly dangerous because they rely on specific conditions, such as tightly packed frames, which may not be immediately obvious during standard testing but can be precisely engineered by an adversary to trigger the fault.
Mitigation strategies for this vulnerability primarily involve upgrading FFmpeg to version 9.1 or later, where the developers have addressed the boundary calculation errors in pcxenc.c. For environments that cannot immediately upgrade, implementing strict input validation on image dimensions before passing them to the encoder can provide a temporary layer of defense. Developers should ensure that width and height parameters are validated against maximum allowable buffer sizes derived from the frame's pixel format and stride values. Additionally, employing memory safety tools such as AddressSanitizer during development and testing phases can help detect similar off-by-one or boundary calculation errors in other parts of the codebase before they reach production systems. Regular auditing of encoding routines for proper bounds checking is essential to maintain the integrity and security of multimedia processing pipelines.