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

COLRv1 ItemVariationData extent overflow causes web-font OOB read on Windows x86

A malformed COLRv1 web font with an oversized ItemVariationData delta-set extent is accepted on Windows x86 due to integer overflow in validation, while the same font is rejected on x64. Rendering the font causes an out-of-bounds read in the content process.

hajim Follow

Originally disclosed on Mozilla

  • Fixed in 41 hours
  • Paid in 50 days
  • Disclosed after 41 hours

Created attachment 9605491 inner2.html

Summary

Firefox accepts a malformed COLRv1 web font on Windows x86 while the same font is rejected on x64. The accepted x86 font reaches COLRv1 variation rendering and crashes a sandboxed content process with an out-of-bounds read in COLRFonts.cpp.

The malformed font uses an ItemVariationData record whose logical delta-set byte extent is larger than the physical COLR table. On Windows x86, validation arithmetic wraps and the font is accepted. Rendering then computes a delta-set pointer from the attacker-controlled variation index and reads outside the valid table data.

The trigger is a normal web path: a page loads the font with @font-face and renders text.

Tested Build

Text
Firefox source commit: cea5f8cacbe1ba3c8c95a7b17a309ce6704a4c7d
Affected platform: Windows x86 Firefox build
Control platform: Windows x64 Firefox build
Firefox version: 154.0a1
Build ID: 20260627203348

Affected Code

Text
gfx/ots/src/variations.cc
gfx/thebes/COLRFonts.cpp

OTS validates the variation data subtable with multiplication in size_t:

C++
if (!subtable.Skip(valueSize * size_t(itemCount) *
                   (size_t(wordDeltaCount) + size_t(*regionIndexCount)))) {
  return OTS_FAILURE_MSG("Failed to read delta data");
}

Gecko's COLRv1 validator and consumer then compute delta-set extents and delta-set pointers:

C++
uint32_t deltaSetSize =
    (uint16_t(regionIndexCount) + uint16_t(wordDeltaCount)) << longWords;
C++
const uint8_t* deltaData =
    reinterpret_cast<const uint8_t*>(deltaSets) + deltaSetSize * innerIndex;

Root Cause

The validation path does not enforce an overflow-safe logical extent for ItemVariationData delta sets on 32-bit builds.

PoC parameters:

Text
regionIndexCount = 32768
wordDeltaCount   = 0x8001  (LONG_WORDS | 1)
itemCount        = 65535
deltaSetSize     = (32768 + 1) << 1 = 65538 bytes
logical extent   = 65535 * 65538 = 4,295,032,830 bytes
physical COLR table length: about 1.5 MB

The logical delta array cannot fit inside the COLR table. On Windows x86, the relevant pointer/extent arithmetic wraps and validation accepts the font. On x64, the same font is rejected.

After acceptance on x86, ApplyVariation() uses the variation index to derive a deltaData pointer and reads outside the valid table contents.

Proof of Concept

Attached files:

Text
poc/colrv1_x86_varstore_inner2.ttf
poc/inner2.html

Run Firefox x86 against inner2.html. The page loads the attached font through @font-face and renders text that reaches the COLRv1 variation code.

Evidence

The malformed font is accepted on x86:

JSON
{
  "arch": "x86",
  "fontsStatus": "loaded",
  "faces": [{"family": "XColr", "status": "loaded"}],
  "check": true
}

The same malformed font is rejected on x64:

JSON
{
  "arch": "x64",
  "fontsStatus": "loaded",
  "faces": [{"family": "XColr", "status": "error"}],
  "check": false
}

The crash is a content-process out-of-bounds read while rendering the web font:

Text
Crash reason:  EXCEPTION_ACCESS_VIOLATION_READ

Thread 0 MainThread (crashed)
 0  xul.dll!(anonymous namespace)::ApplyVariation(...) [COLRFonts.cpp:452]
 1  xul.dll!(anonymous namespace)::PaintVarRadialGradient::MakePattern(...) [COLRFonts.cpp:1176]
 2  xul.dll!(anonymous namespace)::DispatchMakePattern(...) [COLRFonts.cpp:2023]
 3  xul.dll!(anonymous namespace)::PaintGlyph::Paint(...) [COLRFonts.cpp:1300]
 5  xul.dll!(anonymous namespace)::PaintColrGlyph::DoPaint(...) [COLRFonts.cpp:1363]
 6  xul.dll!mozilla::gfx::COLRFonts::PaintGlyphGraph(...) [COLRFonts.cpp:2554]
 7  xul.dll!gfxFont::RenderColorGlyph(...) [gfxFont.cpp:2795]
 8  xul.dll!gfxFont::DrawOneGlyph<1>(...) [gfxFont.cpp:2223]
 10 xul.dll!gfxFont::Draw(...) [gfxFont.cpp:2627]
 12 xul.dll!gfxTextRun::Draw(...) [gfxTextRun.cpp:680]
 15 xul.dll!nsTextFrame::DrawText(...) [nsTextFrame.cpp:8232]
 16 xul.dll!nsTextFrame::PaintText(...) [nsTextFrame.cpp:7905]

Crash metadata:

Text
ProductName=Firefox
Version=154.0a1
BuildID=20260627203348
ProcessType=content
ContentSandboxLevel=9
ContentSandboxWin32kState=Win32k Lockdown enabled

Security Impact

A web page can provide a malformed COLRv1 font and trigger a content-process out-of-bounds read on Windows x86 Firefox during normal text rendering. The report does not claim code execution or an out-of-bounds write.

Suggested Fix

Use checked arithmetic for all ItemVariationData extent calculations in both OTS and Gecko's COLRv1 validation. Reject any table whose logical delta-set array does not fit inside the COLR table before any pointer addition. The same checked extent should be used by ApplyVariation() before computing deltaSetSize * innerIndex.

The original report as published on Mozilla's Bugzilla, by hajim. 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

The validation path does not enforce an overflow-safe logical extent for ItemVariationData delta sets on 32-bit builds.

Impact

A web page could trigger a content-process out-of-bounds read on Windows x86 Firefox during normal text rendering; the report does not claim code execution or an out-of-bounds write.

What the attacker needed

Windows x86 Firefox build; Victim loads a page with the malformed font

The fix

Use checked arithmetic for all ItemVariationData extent calculations in both OTS and Gecko's COLRv1 validation, and reject any table whose logical delta-set array does not fit inside the COLR table before any pointer addition.

How it was found

  1. Load the malformed font through @font-face on a page.
  2. Render text that reaches the COLRv1 variation code.
  3. Observe the content-process out-of-bounds read crash on Windows x86.

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 web font is a file that tells the browser how to draw letters. This font contained a number that was too big for the browser to handle correctly on 32-bit Windows, so the browser accepted a broken font and then read memory it should not have. That caused the browser tab to crash, but the report does not show that an attacker could do more than crash it.

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 hajim

View all

7 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.