Integer overflow in libyuv (CVE-2026-11640)
A signed integer overflow in libyuv's CopyPlane row-coalescing can occur when width times height exceeds the 32-bit signed limit, producing a negative width passed to copy kernels. This could lead to a massive out-of-bounds copy or an infinite loop, potentially causing memory corruption in the GPU or browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 12 days
Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A potential signed integer overflow in libyuv::CopyPlane occurs during row-coalescing when the product of the width and height exceeds the limit of a 32-bit signed integer. This overflow can result in a negative width parameter being passed to copying kernels such as ERMS, SSE2, NEON, or standard memcpy. Consequently, this leads to a massive out-of-bounds copy or an infinite loop, potentially resulting in memory corruption within the GPU or browser process.
Affected files:
third_party/libyuv/source/planar_functions.ccgpu/command_buffer/service/shared_image/copy_image_plane.ccthird_party/libyuv/source/row_gcc.ccthird_party/libyuv/source/row_common.cc
Estimated timestamp from git blame: 2024-07-05
Description
A potential memory safety vulnerability has been identified in libyuv::CopyPlane's row-coalescing implementation. The function performs a signed 32-bit integer multiplication of the width and height parameters without validating that the product does not overflow:
// third_party/libyuv/source/planar_functions.cc
if (src_stride_y == width && dst_stride_y == width) {
width *= height; // Potential signed integer overflow
height = 1;
src_stride_y = dst_stride_y = 0;
}
If an image with extremely large dimensions is processed (for example, a 16384x16384 image using a format with 8 bytes per pixel, such as RGBA_F16), the row width in bytes is 131072 and the height is 16384. The multiplication 131072 * 16384 equals 2,147,483,648 (0x80000000), which overflows a signed 32-bit integer to INT_MIN (-2147483648).
Impact and Technical Mechanism
When a negative value like INT_MIN is assigned to width and passed down to downstream copy kernels, several behaviors can occur depending on the active CPU architecture and instruction set:
-
ERMS Kernel (
CopyRow_ERMS) & C Fallback (CopyRow_C):- The negative
int widthis cast tosize_t. On 64-bit systems, this triggers sign-extension, converting-2147483648to0xFFFFFFFF80000000(approximately 16 exabytes). - The
rep movsbinstruction or the underlyingmemcpyis invoked with this massive count, resulting in a wild out-of-bounds copy.
- The negative
-
SIMD Kernels (
CopyRow_SSE2,CopyRow_NEON):- In
CopyRow_SSE2andCopyRow_NEON, assembly loop implementations subtract a fixed chunk size (e.g., 32 bytes) from the signed loop counter and branch if the remaining count is greater than zero. - When
INT_MINis decremented by 32, it underflows to a large positive integer (2147483616), causing the loop to run indefinitely and corrupt memory.
- In
Potential Reachability in Chrome
This function is reached via gpu::CopyImagePlane in gpu/command_buffer/service/shared_image/copy_image_plane.cc during pixel data uploads or readbacks (e.g., in D3DImageBacking::UploadFromMemory or other platform-specific backing implementations). If a compromised renderer can create and upload to a large SharedImage that bypasses initial size allocations, this could serve as a potential sandbox escape path targeting the GPU process.
Note: These are potential steps analyzed statically; our security analysis tools do not have the capability to execute code or verify runtime exploits.
Suggested Remediation
To prevent this signed integer overflow, validate that the product of width and height does not overflow before coalescing the rows. For example:
if (src_stride_y == width && dst_stride_y == width) {
if (height > 0 && width > 0x7fffffff / height) {
return; // Or handle the error safely without coalescing
}
width *= height;
height = 1;
src_stride_y = dst_stride_y = 0;
}
Evaluated with Chrome root at commit: b1520ef4a76878853a31f0943b565e42060edec8
Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:
- If you are familiar with the severity guidelines, you may adjust the severity.
- If this is a false positive, and there's no work to be done, please close as WAI.
- If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.
Data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The code multiplies width by height without checking for signed 32-bit overflow before using the result as a row width.
Impact
If a compromised renderer can create and upload to a large SharedImage that bypasses initial size allocations, this could serve as a potential sandbox escape path targeting the GPU process.
What the attacker needed
Compromised renderer; large SharedImage bypassing size checks
The fix
The product of width and height should be validated for overflow before coalescing rows, returning safely if it would overflow.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When an image is copied, the code multiplies its width and height to treat it as one long row. If that number is too big for a normal integer, it wraps around to a negative value. That negative size is then used in memory copying, which can make the program read or write far outside the intended buffer.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.