Skip to content
Info disclosure Advisory Advanced CVE-2026-7982

Uninitialized Use in WebCodecs (CVE-2026-7982)

A logic flaw in Chromium's WebCodecs OpenH264 encoder allows an oversized VideoFrame with matching aspect ratio to bypass manual resizing, causing OpenH264 to silently fail preprocessing and compress uninitialized heap memory into an H.264 bitstream. An attacker can decode this bitstream to leak renderer heap contents and defeat ASLR.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 37 days

Project Fortify, an experimental security project, has identified the following potential security issue.

Overview: A vulnerability in Chromium's OpenH264VideoEncoder allows oversized VideoFrames to bypass manual resizing logic when using WebCodecs. This causes silent failures in OpenH264's preprocessing stage, resulting in the encoder compressing uninitialized heap memory into a valid H.264 bitstream. An attacker can decode this bitstream to systematically leak renderer heap contents, defeating ASLR.

Affected files:

  • media/video/openh264_video_encoder.cc
  • third_party/openh264/src/codec/encoder/core/src/wels_preprocess.cpp
  • third_party/openh264/src/codec/processing/src/common/WelsFrameWork.cpp
  • third_party/openh264/src/codec/encoder/core/src/picture_handle.cpp
  • third_party/openh264/src/codec/common/src/memory_align.cpp
  • third_party/openh264/src/codec/encoder/core/src/encoder_ext.cpp

Estimated timestamp from git blame: 2026-03-12

Summary

A critical information disclosure vulnerability exists in the integration between Chromium's WebCodecs API and the software OpenH264 encoder. By providing an oversized VideoFrame that maintains the exact aspect ratio of the configured target resolution, an attacker can bypass Chromium's manual resizing checks. The oversized frame is passed directly to OpenH264, which silently fails during preprocessing due to internal maximum macroblock limits. Consequently, the encoder uses an uninitialized heap buffer allocated via malloc as the source picture for compression. The resulting H.264 bitstream, containing raw renderer heap data, is then delivered to the calling JavaScript context.

Root Cause Analysis

1. Chromium Resizing Bypass (media/video/openh264_video_encoder.cc)

The Encode() method determines if a frame requires manual resizing before being passed to OpenH264 by calling NeedsManualResizing(). This function contains a logical flaw:

C++
// media/video/openh264_video_encoder.cc:154-165
bool NeedsManualResizing(const gfx::Size& src, const gfx::Size& dst) {
  // ...
  if (dst.width() > src.width() || dst.height() > src.height()) {
    return true;
  }
  return VideoAspectRatio::PAR(src.width(), src.height()) !=
         VideoAspectRatio::PAR(dst.width(), dst.height());
}

If an attacker configures the encoder for a 1024x1024 resolution (dst) and provides a 4096x4096 VideoFrame (src), dst > src evaluates to false (bypassing the upscaling check), and the aspect ratios match perfectly (1:1). The function incorrectly returns false, causing the oversized frame to be passed directly to codec_->EncodeFrame() without being downscaled.

2. OpenH264 Silent Preprocessing Failures (third_party/openh264/...)

When OpenH264 receives the oversized 4096x4096 frame, it detects a dimension mismatch against its 1024x1024 configuration and triggers a preprocessing reset (WelsPreprocessReset).

  1. Uninitialized Allocation: WelsInitScaledPic allocates a new pScaledInputPicture buffer using WelsMalloc (memory_align.cpp:72). Crucially, WelsMalloc wraps the standard C malloc function and does not zero-initialize the memory. The buffer contains raw heap data.
  2. Silent Failure in Memory Copy: SingleLayerPreprocess calls WelsMoveMemoryWrapper (wels_preprocess.cpp:383) to copy the oversized input frame into the pre-processing pipeline. Inside WelsMoveMemoryWrapper (wels_preprocess.cpp:1425), a safety check evaluates: if (iSrcWidth * iSrcHeight > (MAX_MBS_PER_FRAME << 8)) return;. The total pixels (4096 * 4096 = 16,777,216) exceed the maximum threshold (36864 * 256 = 9,437,184). The function silently returns void early without copying any pixel data.
  3. Silent Error in Downsampling: SingleLayerPreprocess then attempts to downsample the frame by calling DownsamplePadding (wels_preprocess.cpp:398). This invokes m_pInterfaceVp->Process, which maps to CVpFrameWork::Process (WelsFrameWork.cpp:169). This function calls CheckValid, which evaluates a similar pixel count limit check: if ((iRectWidth * iRectHeight) > (MAX_MBS_PER_FRAME << 8)) return RET_INVALIDPARAM;. This check also fails for the 4096x4096 dimensions, returning the error RET_INVALIDPARAM back to DownsamplePadding.
  4. Error Discarded: DownsamplePadding returns this error code, but SingleLayerPreprocess explicitly discards it (wels_preprocess.cpp:398).

3. Data Leakage

As a result of both preprocessing steps failing silently, the output spatial layer destination buffer (pDstPic) remains completely uninitialized. SingleLayerPreprocess assigns this uninitialized buffer as the spatial layer's source (pSrc). The core encoder (WelsCodeOneSlice) then compresses this raw heap data as if it were valid YUV pixel data. The resulting H.264 bitstream is passed back to the attacker's JavaScript via the WebCodecs EncodedVideoChunk output callback.

By systematically alternating the colorSpace property of the VideoFrame between encode calls, an attacker can force media::OpenH264VideoEncoder::Encode to call UpdateEncoderColorSpace() (openh264_video_encoder.cc:464). This triggers a full OpenH264 codec re-initialization and fresh WelsMalloc allocations, allowing the attacker to continuously leak new, distinct regions of the renderer heap.

Suggested Exploitation Steps

(Note: These are potential steps based on code analysis; a working PoC has not been executed yet.)

  1. In a malicious web page, instantiate a VideoEncoder using the WebCodecs API, forcing the OpenH264 software implementation.
  2. Configure the encoder with a standard target resolution, e.g., 1024x1024.
  3. Create a VideoFrame with dimensions significantly larger than the configuration (e.g., 4096x4096) that maintains the exact same aspect ratio.
  4. Call encode() on the oversized frame.
  5. In the output callback, receive the EncodedVideoChunk containing the H.264 bitstream.
  6. Decode the bitstream using a standard H.264 decoder to retrieve the uninitialized renderer heap memory (pixel data).
  7. To leak continuous memory regions, alternate the colorSpace of the input VideoFrame between encodes to force codec re-initialization.

Suggested Fix

  1. Chromium: Update NeedsManualResizing in media/video/openh264_video_encoder.cc to ensure that frames larger than the target resolution in either dimension (downscaling) are manually resized if OpenH264's internal downscaler is deemed unsafe for extremely large frames. Alternatively, add explicit bounds checking (e.g., against MAX_MBS_PER_FRAME) before passing frames to EncodeFrame().
  2. OpenH264:
    • Modify WelsMalloc to use calloc or explicitly memset the allocated memory to zero to prevent uninitialized memory disclosures.
    • Update SingleLayerPreprocess in wels_preprocess.cpp to properly handle and propagate the error codes returned by DownsamplePadding and WelsMoveMemoryWrapper instead of silently ignoring them.

Evaluated with Chrome root at commit: a9cbf6e8b275fe4147435aa905f3b7f5a656f5f0


Results from 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 the resizing check in NeedsManualResizing only rejects frames smaller than the target and mismatched aspect ratios, not oversized frames with matching aspect ratio, and OpenH264 silently ignores preprocessing errors and uses uninitialized memory.

Impact

An attacker could leak renderer heap contents, defeating ASLR; the text notes a working proof-of-concept has not been executed yet.

What the attacker needed

Victim visits a malicious web page; browser supports WebCodecs with OpenH264

The fix

Chromium should add explicit bounds checking before passing frames to EncodeFrame, and OpenH264 should zero-initialize allocations and propagate preprocessing errors instead of ignoring them.

How it was found

  1. Instantiate a VideoEncoder using the WebCodecs API, forcing the OpenH264 software implementation.
  2. Configure the encoder with a standard target resolution, e.g., 1024x1024.
  3. Create a VideoFrame with dimensions significantly larger than the configuration (e.g., 4096x4096) that maintains the exact same aspect ratio.
  4. Call encode() on the oversized frame.
  5. In the output callback, receive the EncodedVideoChunk containing the H.264 bitstream.
  6. Decode the bitstream using a standard H.264 decoder to retrieve the uninitialized renderer heap memory (pixel data).

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 a web page uses the WebCodecs API to encode video, Chromium sometimes passes the frame to a software encoder called OpenH264. A mistake in Chromium's size check lets a much larger frame through without resizing it. OpenH264 then fails to copy the pixel data but still encodes whatever was left in memory, so the resulting video contains secret memory contents that the attacker can read.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.