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

Improper validation of array index in ANGLE (CVE-2026-87500)

A bounds-checking and index-clamping routine for gl_FragData in ANGLE only inspects the immediate base expression, so wrapping gl_FragData in a comma operator hides its qualifier and skips the check. This lets a shader compile to malformed SPIR-V with an out-of-bounds access into a shader output array, which the report says could lead to driver-level memory corruption in the GPU process.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 43 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 vulnerability in ANGLE allows bypassing array-bounds checking and index-clamping for gl_FragData using a comma operator. This results in the generation of malformed SPIR-V containing an out-of-bounds OpAccessChain. This issue could potentially lead to driver-level memory corruption in the GPU process.

Affected files:

  • third_party/angle/src/compiler/translator/ParseContext.cpp
  • third_party/angle/src/compiler/translator/tree_ops/spirv/EmulateFragColorData.cpp
  • third_party/angle/src/compiler/translator/IntermNode.cpp
  • third_party/angle/src/compiler/translator/spirv/OutputSPIRV.cpp

Estimated timestamp from git blame: 2026-04-27

Potential out-of-bounds gl_FragData indexing bypass via comma operator

Root Cause Analysis

In third_party/angle/src/compiler/translator/ParseContext.cpp, TParseContext::addIndexExpression performs bounds tracking and safety-clamping for gl_FragData only when the immediate baseExpression has the qualifier EvqFragData:

C++
// third_party/angle/src/compiler/translator/ParseContext.cpp
if (!baseExpression->getType().isUnsizedArray())
{
    if (baseExpression->isArray() && baseExpression->getQualifier() == EvqFragData)
    {
        mMaxFragDataArrayIndexUsed = std::max(mMaxFragDataArrayIndexUsed, index);
        if (index > 0 && !isExtensionEnabled(TExtension::EXT_draw_buffers))
        {
            outOfRangeError(...);
            safeIndex = 0;
        }
    }

When gl_FragData is wrapped inside a sequence/comma operator—such as (sideEffect, gl_FragData)[7]—the qualifier of the resulting EOpComma node is evaluated as EvqTemporary (via GetCommaQualifier in IntermNode.cpp:1846). This causes the compiler to completely skip the tracking and clamping logic shown above.

Because the generic bounds check at ParseContext.cpp:7481 checks against the comma node's promoted outermost array size (which copies the type of its right operand gl_FragData, e.g., vec4[8]), a constant index such as 7 is successfully validated and retained.

Subsequently, during translation inside the Vulkan/SPIR-V backend, EmulateFragColorData (tree_ops/spirv/EmulateFragColorData.cpp:76-99) shrinks the output array to mResources.MaxDualSourceDrawBuffers (which is 1 when gl_SecondaryFragDataEXT is statically used). However, because TIntermBinary::replaceChildNode is used to replace the symbol without re-promoting parent node types, the parent nodes still assume a size of 8. Consequently, the code generator emits a direct OpAccessChain with the constant index 7 into an Output array declared with size 1.

This produces malformed SPIR-V that violates Vulkan's Valid Usage requirements. Since Vulkan's robustBufferAccess does not cover the Output storage class, this can trigger driver-defined behavior or memory corruption in the GPU process.


Potential Steps to Reproduce

Note: These are suggested/potential steps to reproduce. Our tooling agent does not currently have the capability to execute code or verify the exploitability of this issue on a live target.

  1. Initialize a standard WebGL1 context on a page:

    JavaScript
    const gl = canvas.getContext('webgl');
    
  2. Enable the required extensions (both stable and non-privileged):

    JavaScript
    gl.getExtension('WEBGL_draw_buffers');
    gl.getExtension('WEBGL_blend_func_extended');
    
  3. Submit and compile a fragment shader containing a comma-wrapped access into gl_FragData combined with dual-source blending, for example:

    GLSL
    #extension GL_EXT_blend_func_extended : require
    precision mediump float;
    void main() {
        gl_SecondaryFragDataEXT[0] = vec4(0.5);
        vec4 c = (gl_SecondaryFragDataEXT[0] = vec4(0.5), gl_FragData)[7];
        gl_FragData[0] = c;
    }
    
  4. Link the program and execute a draw call. This triggers the generation of malformed SPIR-V inside the GPU process, potentially resulting in memory corruption within the platform graphics driver.


Suggested Fix

To remediate this issue, update TParseContext::addIndexExpression in ParseContext.cpp to recursively traverse through any sequence/comma operator nodes on the baseExpression to locate the underlying operand. This ensures that indexing constraints on gl_FragData (or similar built-ins) are correctly applied even when wrapped in a comma operator, matching the pattern already used in IsWholeArrayFragDataUsed:

C++
TIntermTyped *realBase = baseExpression;
while (realBase && realBase->getAsBinaryNode() && realBase->getAsBinaryNode()->getOp() == EOpComma)
{
    realBase = realBase->getAsBinaryNode()->getRight();
}

if (realBase && realBase->isArray() && realBase->getQualifier() == EvqFragData)
{
    // ... perform tracking and safety-clamping on the underlying gl_FragData ...
}

Evaluated with Chrome root at commit: 94d9235ebe3b7276e5284f0dc5d55577ff949908


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.

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 qualifier check in addIndexExpression only looks at the immediate base expression, so a comma operator node (whose qualifier resolves to a temporary) bypasses the gl_FragData tracking and clamping, and later array shrinking in EmulateFragColorData does not re-promote parent node types.

Impact

The malformed SPIR-V could trigger driver-defined behaviour or memory corruption in the GPU process; the report notes robustBufferAccess does not cover the Output storage class, and the steps were not actually executed or verified.

What the attacker needed

WebGL1 context; draw buffers and extended blend extensions; attacker-supplied shader; draw call executed

The fix

The report suggests making addIndexExpression walk through comma operator nodes to the underlying operand so the gl_FragData tracking and clamping still apply; it does not say the issue was fixed.

How it was found

  1. Create a WebGL1 context on a page.
  2. Enable the draw buffers and extended blend function extensions.
  3. Compile a fragment shader that uses dual-source blending and indexes gl_FragData through a comma expression.
  4. Link the program and issue a draw call, which produces malformed SPIR-V in the GPU process.

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 shader is a small program that runs on the graphics card. ANGLE is the layer that translates web shaders into a form the graphics driver understands, and it is meant to stop a shader from reading or writing outside the small fixed list of output slots it is allowed to use. Here a quirk of the shader language (the comma operator, which just evaluates two things in order and keeps the second) made the translator lose track of which output list it was looking at, so the safety check was skipped and an out-of-range slot was passed to the driver.

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.