Skip to content
Memory corruption Advisory Advanced CVE-2026-87579

Buffer overflow in WebRTC (CVE-2026-87579)

A heap out-of-bounds write exists in the OpenH264 encoder's SSE2 routine when processing wide video frames on CPUs without SSE4.1. An attacker could supply a crafted video frame via WebCodecs to corrupt heap memory in the renderer process, potentially leading to remote code execution.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 5 months

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 without the Chrome Security team. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.

Overview: A potential heap out-of-bounds write exists in the OpenH264 software encoder when processing large video frames on CPUs without SSE4.1 support. A stale 17th bit in an SSE2 assembly register leads to an out-of-bounds array index calculation during motion estimation. This allows an attacker to perform controlled heap corruption (dword increments) in the sandboxed renderer process by supplying a wide video frame via WebCodecs.

Affected files:

  • third_party/openh264/src/codec/encoder/core/x86/sample_sc.asm
  • third_party/openh264/src/codec/encoder/core/src/svc_motion_estimate.cpp

Estimated timestamp from git blame: 2015-04-27

Summary

A potential heap out-of-bounds (OOB) write vulnerability exists in the OpenH264 encoder's SSE2-optimized routine SumOf8x8BlockOfFrame_sse2. The issue is caused by the reuse of register r6 without clearing its upper bits, leading to a corrupted index calculation when the video stride is sufficiently large. This results in an out-of-bounds inc dword operation on the heap in the renderer process.

Root Cause

When using WebCodecs, an attacker can instantiate a VideoEncoder with an unusually wide resolution, such as a width of 21824 and a height of 16. Because this results in only 1364 macroblocks, it bypasses OpenH264's kOpenH264MaxMBs (36864) limit and is accepted.

During frame encoding with contentHint set to "detail" (screen content mode), the frame's padded stride (kiRefStride) becomes 21888.

In third_party/openh264/src/codec/encoder/core/x86/sample_sc.asm, the routine SumOf8x8BlockOfFrame_sse2 (used for x86-64 when SSE4.1 is unavailable) initializes register r6 with the value 3 * kiRefStride:

NASM
; sample_sc.asm:854
lea     r6, [r3+r3*2]       ; r6 = 3 * 21888 = 65664 (0x10080)

Because 65664 requires 17 bits, the 17th bit (bit 16, 0x10000) of r6 is set.

Inside the WIDTH_LOOP, the routine reuses r6 to load a 16-bit previous sum from the pFeatureOfBlock memory. However, it uses a 16-bit move instruction:

NASM
; sample_sc.asm:909-912
mov     r6w,    [r4]        ; r6w = prev 8x8 sum (16-bit)
add     r2d,    r6d         ; r2d = diff + r6d
mov     [r4+r1*2],  r2w
inc     dword [r5+r2*4]     ; pTimesOfFeatureValue[r2]++

In x86/x64 assembly, an explicit 16-bit register move (mov r6w) does not zero-extend. It only overwrites the lowest 16 bits of the r6 register. The upper bits of r6d—including the 0x10000 bit from the earlier 3 * kiRefStride calculation—remain intact.

Consequently, the add r2d, r6d instruction erroneously adds at least 65536 to r2d. The resulting index r2 is mathematically guaranteed to be >= 65536.

At line 912, the code increments a 32-bit integer in the pTimesOfFeatureValue array using this index. However, pTimesOfFeatureValue is allocated (via WelsMallocz) with only 16,321 elements (LIST_SIZE_SUM_8x8). The instruction increments memory roughly 196KB past the end of the allocation on the renderer process's heap.

Potential Attack Steps

Note: These are suggested steps based on static analysis; our tooling cannot execute code.

  1. Initialize a WebCodecs VideoEncoder with codec: "avc1.42001E", width: 21824, height: 16, and contentHint: "detail".
  2. Generate and provide a base VideoFrame to the encoder.
  3. Generate and provide a second VideoFrame containing carefully crafted pixel patterns.
  4. On a system lacking SSE4.1 support, the P-frame generation will trigger SumOf8x8BlockOfFrame_sse2.
  5. The SSE2 routine performs thousands of OOB inc dword operations per row.
  6. By controlling the pixel differences between frames, the attacker controls the exact offset and increment values, corrupting adjacent heap metadata/vtables to achieve Remote Code Execution (RCE) in the renderer.

Proposed Fix

In third_party/openh264/src/codec/encoder/core/x86/sample_sc.asm, explicitly zero the r6 register before entering the WIDTH_LOOP or use movzx r6d, word [r4] instead of mov r6w, [r4] to ensure the upper bits are cleared during the read.

Evaluated with Chrome root at commit: 7353d249d9cacf9c7218e1d7b8a39cf39c72d646


Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; 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.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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

Likely, a 16-bit register move does not clear the upper bits of the register, so a previously set bit remains and causes an out-of-bounds index calculation.

Impact

An attacker could corrupt heap memory in the sandboxed renderer process, potentially leading to remote code execution.

What the attacker needed

CPU without SSE4.1 support; WebCodecs API available; Attacker can supply crafted video frames

The fix

The fix should explicitly zero the r6 register before the loop or use a zero-extending move to clear the upper bits.

How it was found

  1. Initialize a WebCodecs VideoEncoder with a wide resolution and contentHint set to detail.
  2. Provide a base VideoFrame to the encoder.
  3. Provide a second VideoFrame with crafted pixel patterns.
  4. On a system lacking SSE4.1, the P-frame generation triggers the vulnerable SSE2 routine.
  5. The routine performs out-of-bounds increments on the heap.
  6. By controlling pixel differences, the attacker controls the offset and increment values to corrupt heap metadata.

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.

This report describes a bug in a video encoding library where a calculation goes wrong for very wide videos on older processors. The mistake causes the program to write data outside its intended memory area, which an attacker could exploit to run malicious code.

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.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.