CVE-2026-135709 in FFmpeg
Summary
by MITRE • 11/24/2026
FFmpeg before 9.1 contains an out-of-bounds write vulnerability in ogg_buffer_data() in libavformat/oggenc.c because ogg_buffer_page() leaves a full page current after failed allocation. When page allocation fails, a memset with length (size_t)-1 or an overflowing memcpy writes past the segment table, causing heap memory corruption and crashes when writing Ogg output.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 11/24/2026
The vulnerability identified in FFmpeg versions prior to 9.1 represents a critical out-of-bounds write condition located within the ogg_buffer_data function of the libavformat/oggenc.c module. This flaw is directly triggered by improper error handling during page allocation processes, specifically when the system fails to allocate sufficient memory for an Ogg page structure. The root cause lies in the behavior of the ogg_buffer_page function, which incorrectly maintains a reference to a full or partially initialized page object even after a memory allocation failure occurs. This state inconsistency allows subsequent operations to proceed under the false assumption that valid memory buffers are available and properly sized, leading to unsafe memory access patterns.
When the underlying memory allocator returns a null pointer or indicates an allocation failure, the code execution path does not abort safely as intended. Instead, it proceeds to execute a memset operation with a length parameter casted from -1 to size_t, which results in writing nearly four gigabytes of data on 32-bit systems or significantly more on larger architectures if unsigned integer overflow logic is involved. Alternatively, depending on the specific code path and compiler optimizations, an overflowing memcpy may be executed that writes past the boundaries of the allocated segment table. This behavior constitutes a classic heap-based buffer over-read followed by a write operation beyond the bounds of the intended data structure. The lack of proper boundary checks before these memory manipulation functions allows arbitrary amounts of data to be written into adjacent memory regions, corrupting critical heap metadata and application state variables stored nearby in memory.
The operational impact of this vulnerability is severe, primarily manifesting as denial-of-service conditions through application crashes or segmentation faults when processing maliciously crafted Ogg container files. An attacker can exploit this flaw by providing a specially designed input file that triggers the specific allocation failure scenario within the encoding pipeline. Upon encountering this malformed input, FFmpeg will attempt to write excessive data into heap memory, causing immediate instability and termination of the process. In more complex deployment scenarios where FFmpeg is used as part of a larger service or library, such heap corruption can potentially lead to code execution vulnerabilities if an attacker can precisely control the contents written beyond the buffer boundaries and manipulate adjacent pointers or function return addresses. This aligns with Common Weakness Enumeration CWE-787, which classifies out-of-bounds writes that allow writing past the end of a buffer into other memory locations.
From a threat intelligence perspective, this vulnerability maps to MITRE ATT&CK technique T1496, Resource Hijacking, as it enables an attacker to cause denial of service by exhausting system resources or crashing services. It also relates to CWE-789, Memory Allocation with Excessive Size Value, due to the use of -1 casted to size_t for length parameters in memory operations. The flaw highlights a critical gap in defensive programming practices within the media processing library, specifically regarding error handling paths that fail to reset state variables or nullify pointers after allocation failures.
Mitigation strategies must prioritize immediate upgrading to FFmpeg version 9.1 or later, where this logic has been corrected to properly handle allocation errors and prevent out-of-bounds writes. For environments unable to upgrade immediately, input validation mechanisms should be implemented at the ingestion layer to detect malformed Ogg streams before they reach the encoding engine. Additionally, enabling heap protection features such as AddressSanitizer during development and testing phases can help identify similar logic flaws in other parts of the codebase that may not yet have been discovered. Security teams should also monitor for abnormal memory usage patterns or frequent crashes associated with media processing services to detect potential exploitation attempts in real-time.